2016-10-22 08:49:13

by Baoyou Xie

[permalink] [raw]
Subject: [PATCH 1/3] drm/amdgpu: change function declarations and add missing header dependencies

We get a few warnings when building kernel with W=1:
drivers/gpu/drm/amd/amdgpu/atombios_crtc.c:38:6: warning: no previous prototype for 'amdgpu_atombios_crtc_overscan_setup' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c:661:6: warning: no previous prototype for 'dce_v8_0_disable_dce' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:40:5: warning: no previous prototype for 'amdgpu_gfx_scratch_get' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:62:6: warning: no previous prototype for 'amdgpu_gfx_scratch_free' [-Wmissing-prototypes]
....

In fact, these functions are declared in
drivers/gpu/drm/amd/amdgpu/atombios_crtc.h
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
drivers/gpu/drm/amd/amdgpu/dce_v8_0.h
drivers/gpu/drm/amd/amdgpu/dce_v10_0.h
drivers/gpu/drm/amd/amdgpu/dce_v11_0.h
drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h.
So this patch adds missing header dependencies.

By the way, this patch changes declaration of amdgpu_gfx_parse_disable_cu()
to subject to its implement, and clean three function declarations
in pp_acpi.h up.

Signed-off-by: Baoyou Xie <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 3 ++-
drivers/gpu/drm/amd/amdgpu/atombios_crtc.c | 1 +
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 1 +
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 1 +
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 1 +
drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c | 1 +
drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h | 9 +++------
8 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index a074edd..01a42b6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -24,6 +24,7 @@
*/
#include <drm/drmP.h>
#include "amdgpu.h"
+#include "amdgpu_gfx.h"

/*
* GPU scratch registers helpers function.
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
index 51321e1..abd9432 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
@@ -27,6 +27,7 @@
int amdgpu_gfx_scratch_get(struct amdgpu_device *adev, uint32_t *reg);
void amdgpu_gfx_scratch_free(struct amdgpu_device *adev, uint32_t reg);

-unsigned amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_sh);
+void amdgpu_gfx_parse_disable_cu(unsigned int *mask, unsigned int max_se,
+ unsigned int max_sh);

#endif
diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c b/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
index f7d236f..8c9bc75 100644
--- a/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
+++ b/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
@@ -31,6 +31,7 @@
#include "atom.h"
#include "atom-bits.h"
#include "atombios_encoders.h"
+#include "atombios_crtc.h"
#include "amdgpu_atombios.h"
#include "amdgpu_pll.h"
#include "amdgpu_connectors.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 4108c68..443b35f 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -31,6 +31,7 @@
#include "atombios_encoders.h"
#include "amdgpu_pll.h"
#include "amdgpu_connectors.h"
+#include "dce_v10_0.h"

#include "dce/dce_10_0_d.h"
#include "dce/dce_10_0_sh_mask.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index f264b8f..d58638c 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -31,6 +31,7 @@
#include "atombios_encoders.h"
#include "amdgpu_pll.h"
#include "amdgpu_connectors.h"
+#include "dce_v11_0.h"

#include "dce/dce_11_0_d.h"
#include "dce/dce_11_0_sh_mask.h"
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 5966166..dd5838c 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -31,6 +31,7 @@
#include "atombios_encoders.h"
#include "amdgpu_pll.h"
#include "amdgpu_connectors.h"
+#include "dce_v8_0.h"

#include "dce/dce_8_0_d.h"
#include "dce/dce_8_0_sh_mask.h"
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
index 1944d28..f5e8fda 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
@@ -25,6 +25,7 @@
#include "linux/delay.h"
#include "hwmgr.h"
#include "amd_acpi.h"
+#include "pp_acpi.h"

bool acpi_atcs_functions_supported(void *device, uint32_t index)
{
diff --git a/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h b/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h
index 3df5de2..8fe8ba9 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h
@@ -21,9 +21,6 @@
*
*/

-extern bool acpi_atcs_functions_supported(void *device,
- uint32_t index);
-extern int acpi_pcie_perf_request(void *device,
- uint8_t perf_req,
- bool advertise);
-extern bool acpi_atcs_notify_pcie_device_ready(void *device);
+bool acpi_atcs_functions_supported(void *device, uint32_t index);
+int acpi_pcie_perf_request(void *device, uint8_t perf_req, bool advertise);
+bool acpi_atcs_notify_pcie_device_ready(void *device);
--
2.7.4


2016-10-22 08:49:46

by Baoyou Xie

[permalink] [raw]
Subject: [PATCH 3/3] drm/amdgpu: move function declaration to header file

We get 1 warning when building kernel with W=1:
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:37:6: warning: no previous prototype for 'amdgpu_pm_acpi_event_handler' [-Wmissing-prototypes]

In fact, this function is defined in
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c, but should be declared
in a header file. So this patch moves the function declaration
to drivers/gpu/drm/amd/amdgpu/amdgpu.h.

Signed-off-by: Baoyou Xie <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 1 -
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 039b57e..c0bc42b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -2145,6 +2145,8 @@ void amdgpu_io_wreg(struct amdgpu_device *adev, u32 reg, u32 v);
u32 amdgpu_mm_rdoorbell(struct amdgpu_device *adev, u32 index);
void amdgpu_mm_wdoorbell(struct amdgpu_device *adev, u32 index, u32 v);

+void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev);
+
/*
* Registers read & write functions.
*/
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
index 5796539..d77d630 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
@@ -33,7 +33,6 @@
#include "amd_acpi.h"
#include "atom.h"

-extern void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev);
/* Call the ATIF method
*/
/**
--
2.7.4

2016-10-22 08:49:25

by Baoyou Xie

[permalink] [raw]
Subject: [PATCH 2/3] drm/amdgpu: mark symbols static where possible

We get 2 warnings when building kernel with W=1:
drivers/gpu/drm/amd/amdgpu/si.c:908:5: warning: no previous prototype for 'si_pciep_rreg' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/si.c:921:6: warning: no previous prototype for 'si_pciep_wreg' [-Wmissing-prototypes]

In fact, both functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
So this patch marks these functions with 'static'.

Signed-off-by: Baoyou Xie <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/si.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/si.c b/drivers/gpu/drm/amd/amdgpu/si.c
index dc9511c..bacdff8 100644
--- a/drivers/gpu/drm/amd/amdgpu/si.c
+++ b/drivers/gpu/drm/amd/amdgpu/si.c
@@ -905,7 +905,7 @@ static void si_pcie_wreg(struct amdgpu_device *adev, u32 reg, u32 v)
spin_unlock_irqrestore(&adev->pcie_idx_lock, flags);
}

-u32 si_pciep_rreg(struct amdgpu_device *adev, u32 reg)
+static u32 si_pciep_rreg(struct amdgpu_device *adev, u32 reg)
{
unsigned long flags;
u32 r;
@@ -918,7 +918,7 @@ u32 si_pciep_rreg(struct amdgpu_device *adev, u32 reg)
return r;
}

-void si_pciep_wreg(struct amdgpu_device *adev, u32 reg, u32 v)
+static void si_pciep_wreg(struct amdgpu_device *adev, u32 reg, u32 v)
{
unsigned long flags;

--
2.7.4

2016-10-22 09:30:45

by Edward O'Callaghan

[permalink] [raw]
Subject: Re: [PATCH 1/3] drm/amdgpu: change function declarations and add missing header dependencies

This series is,
Acked-by: Edward O'Callaghan <[email protected]>

On 10/22/2016 07:48 PM, Baoyou Xie wrote:
> We get a few warnings when building kernel with W=1:
> drivers/gpu/drm/amd/amdgpu/atombios_crtc.c:38:6: warning: no previous prototype for 'amdgpu_atombios_crtc_overscan_setup' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/dce_v8_0.c:661:6: warning: no previous prototype for 'dce_v8_0_disable_dce' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:40:5: warning: no previous prototype for 'amdgpu_gfx_scratch_get' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:62:6: warning: no previous prototype for 'amdgpu_gfx_scratch_free' [-Wmissing-prototypes]
> ....
>
> In fact, these functions are declared in
> drivers/gpu/drm/amd/amdgpu/atombios_crtc.h
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> drivers/gpu/drm/amd/amdgpu/dce_v8_0.h
> drivers/gpu/drm/amd/amdgpu/dce_v10_0.h
> drivers/gpu/drm/amd/amdgpu/dce_v11_0.h
> drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h.
> So this patch adds missing header dependencies.
>
> By the way, this patch changes declaration of amdgpu_gfx_parse_disable_cu()
> to subject to its implement, and clean three function declarations
> in pp_acpi.h up.
>
> Signed-off-by: Baoyou Xie <[email protected]>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 1 +
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 3 ++-
> drivers/gpu/drm/amd/amdgpu/atombios_crtc.c | 1 +
> drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 1 +
> drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 1 +
> drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 1 +
> drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c | 1 +
> drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h | 9 +++------
> 8 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index a074edd..01a42b6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -24,6 +24,7 @@
> */
> #include <drm/drmP.h>
> #include "amdgpu.h"
> +#include "amdgpu_gfx.h"
>
> /*
> * GPU scratch registers helpers function.
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> index 51321e1..abd9432 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> @@ -27,6 +27,7 @@
> int amdgpu_gfx_scratch_get(struct amdgpu_device *adev, uint32_t *reg);
> void amdgpu_gfx_scratch_free(struct amdgpu_device *adev, uint32_t reg);
>
> -unsigned amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_sh);
> +void amdgpu_gfx_parse_disable_cu(unsigned int *mask, unsigned int max_se,
> + unsigned int max_sh);
>
> #endif
> diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c b/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
> index f7d236f..8c9bc75 100644
> --- a/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
> @@ -31,6 +31,7 @@
> #include "atom.h"
> #include "atom-bits.h"
> #include "atombios_encoders.h"
> +#include "atombios_crtc.h"
> #include "amdgpu_atombios.h"
> #include "amdgpu_pll.h"
> #include "amdgpu_connectors.h"
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index 4108c68..443b35f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -31,6 +31,7 @@
> #include "atombios_encoders.h"
> #include "amdgpu_pll.h"
> #include "amdgpu_connectors.h"
> +#include "dce_v10_0.h"
>
> #include "dce/dce_10_0_d.h"
> #include "dce/dce_10_0_sh_mask.h"
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index f264b8f..d58638c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -31,6 +31,7 @@
> #include "atombios_encoders.h"
> #include "amdgpu_pll.h"
> #include "amdgpu_connectors.h"
> +#include "dce_v11_0.h"
>
> #include "dce/dce_11_0_d.h"
> #include "dce/dce_11_0_sh_mask.h"
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 5966166..dd5838c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -31,6 +31,7 @@
> #include "atombios_encoders.h"
> #include "amdgpu_pll.h"
> #include "amdgpu_connectors.h"
> +#include "dce_v8_0.h"
>
> #include "dce/dce_8_0_d.h"
> #include "dce/dce_8_0_sh_mask.h"
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
> index 1944d28..f5e8fda 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
> @@ -25,6 +25,7 @@
> #include "linux/delay.h"
> #include "hwmgr.h"
> #include "amd_acpi.h"
> +#include "pp_acpi.h"
>
> bool acpi_atcs_functions_supported(void *device, uint32_t index)
> {
> diff --git a/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h b/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h
> index 3df5de2..8fe8ba9 100644
> --- a/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h
> +++ b/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h
> @@ -21,9 +21,6 @@
> *
> */
>
> -extern bool acpi_atcs_functions_supported(void *device,
> - uint32_t index);
> -extern int acpi_pcie_perf_request(void *device,
> - uint8_t perf_req,
> - bool advertise);
> -extern bool acpi_atcs_notify_pcie_device_ready(void *device);
> +bool acpi_atcs_functions_supported(void *device, uint32_t index);
> +int acpi_pcie_perf_request(void *device, uint8_t perf_req, bool advertise);
> +bool acpi_atcs_notify_pcie_device_ready(void *device);
>


Attachments:
signature.asc (819.00 B)
OpenPGP digital signature

2016-10-24 09:35:53

by Christian König

[permalink] [raw]
Subject: Re: [PATCH 1/3] drm/amdgpu: change function declarations and add missing header dependencies

Am 22.10.2016 um 10:48 schrieb Baoyou Xie:
> We get a few warnings when building kernel with W=1:
> drivers/gpu/drm/amd/amdgpu/atombios_crtc.c:38:6: warning: no previous prototype for 'amdgpu_atombios_crtc_overscan_setup' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/dce_v8_0.c:661:6: warning: no previous prototype for 'dce_v8_0_disable_dce' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:40:5: warning: no previous prototype for 'amdgpu_gfx_scratch_get' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:62:6: warning: no previous prototype for 'amdgpu_gfx_scratch_free' [-Wmissing-prototypes]
> ....
>
> In fact, these functions are declared in
> drivers/gpu/drm/amd/amdgpu/atombios_crtc.h
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> drivers/gpu/drm/amd/amdgpu/dce_v8_0.h
> drivers/gpu/drm/amd/amdgpu/dce_v10_0.h
> drivers/gpu/drm/amd/amdgpu/dce_v11_0.h
> drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h.
> So this patch adds missing header dependencies.
>
> By the way, this patch changes declaration of amdgpu_gfx_parse_disable_cu()
> to subject to its implement, and clean three function declarations
> in pp_acpi.h up.
>
> Signed-off-by: Baoyou Xie <[email protected]>

Patch #2 and #3 of this series is Reviewed-by: Christian K?nig
<[email protected]>.

The powerplay part is developed by a different team inside AMD, so it
would be nice to split that change in a different patch and CC
[email protected] on it.

This is only nice to have, so feel free to add an Acked-by: Christian
K?nig <[email protected]> on the current version of the patch as
well.

BTW: Any objections to add Rex into MAINTAINERS for the powerplay
component? The rather extensive TO list on this trivial patch shows that
we clearly need to better delegate responsibilities, otherwise people
will sooner or later start to CC half AMD on fixing a typo :)

Regards,
Christian.

> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 1 +
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 3 ++-
> drivers/gpu/drm/amd/amdgpu/atombios_crtc.c | 1 +
> drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 1 +
> drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 1 +
> drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 1 +
> drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c | 1 +
> drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h | 9 +++------
> 8 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index a074edd..01a42b6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -24,6 +24,7 @@
> */
> #include <drm/drmP.h>
> #include "amdgpu.h"
> +#include "amdgpu_gfx.h"
>
> /*
> * GPU scratch registers helpers function.
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> index 51321e1..abd9432 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> @@ -27,6 +27,7 @@
> int amdgpu_gfx_scratch_get(struct amdgpu_device *adev, uint32_t *reg);
> void amdgpu_gfx_scratch_free(struct amdgpu_device *adev, uint32_t reg);
>
> -unsigned amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_sh);
> +void amdgpu_gfx_parse_disable_cu(unsigned int *mask, unsigned int max_se,
> + unsigned int max_sh);
>
> #endif
> diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c b/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
> index f7d236f..8c9bc75 100644
> --- a/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
> @@ -31,6 +31,7 @@
> #include "atom.h"
> #include "atom-bits.h"
> #include "atombios_encoders.h"
> +#include "atombios_crtc.h"
> #include "amdgpu_atombios.h"
> #include "amdgpu_pll.h"
> #include "amdgpu_connectors.h"
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index 4108c68..443b35f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -31,6 +31,7 @@
> #include "atombios_encoders.h"
> #include "amdgpu_pll.h"
> #include "amdgpu_connectors.h"
> +#include "dce_v10_0.h"
>
> #include "dce/dce_10_0_d.h"
> #include "dce/dce_10_0_sh_mask.h"
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index f264b8f..d58638c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -31,6 +31,7 @@
> #include "atombios_encoders.h"
> #include "amdgpu_pll.h"
> #include "amdgpu_connectors.h"
> +#include "dce_v11_0.h"
>
> #include "dce/dce_11_0_d.h"
> #include "dce/dce_11_0_sh_mask.h"
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 5966166..dd5838c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -31,6 +31,7 @@
> #include "atombios_encoders.h"
> #include "amdgpu_pll.h"
> #include "amdgpu_connectors.h"
> +#include "dce_v8_0.h"
>
> #include "dce/dce_8_0_d.h"
> #include "dce/dce_8_0_sh_mask.h"
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
> index 1944d28..f5e8fda 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
> @@ -25,6 +25,7 @@
> #include "linux/delay.h"
> #include "hwmgr.h"
> #include "amd_acpi.h"
> +#include "pp_acpi.h"
>
> bool acpi_atcs_functions_supported(void *device, uint32_t index)
> {
> diff --git a/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h b/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h
> index 3df5de2..8fe8ba9 100644
> --- a/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h
> +++ b/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h
> @@ -21,9 +21,6 @@
> *
> */
>
> -extern bool acpi_atcs_functions_supported(void *device,
> - uint32_t index);
> -extern int acpi_pcie_perf_request(void *device,
> - uint8_t perf_req,
> - bool advertise);
> -extern bool acpi_atcs_notify_pcie_device_ready(void *device);
> +bool acpi_atcs_functions_supported(void *device, uint32_t index);
> +int acpi_pcie_perf_request(void *device, uint8_t perf_req, bool advertise);
> +bool acpi_atcs_notify_pcie_device_ready(void *device);


2016-10-24 16:29:09

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH 3/3] drm/amdgpu: move function declaration to header file

On Sat, Oct 22, 2016 at 4:48 AM, Baoyou Xie <[email protected]> wrote:
> We get 1 warning when building kernel with W=1:
> drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:37:6: warning: no previous prototype for 'amdgpu_pm_acpi_event_handler' [-Wmissing-prototypes]
>
> In fact, this function is defined in
> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c, but should be declared
> in a header file. So this patch moves the function declaration
> to drivers/gpu/drm/amd/amdgpu/amdgpu.h.

I want to try and avoid making amdgpu.h a random dumping ground for
function defs. Let's put it in amdgpu_pm.h instead. How about the
attached patch?

Alex


>
> Signed-off-by: Baoyou Xie <[email protected]>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++
> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 1 -
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 039b57e..c0bc42b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -2145,6 +2145,8 @@ void amdgpu_io_wreg(struct amdgpu_device *adev, u32 reg, u32 v);
> u32 amdgpu_mm_rdoorbell(struct amdgpu_device *adev, u32 index);
> void amdgpu_mm_wdoorbell(struct amdgpu_device *adev, u32 index, u32 v);
>
> +void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev);
> +
> /*
> * Registers read & write functions.
> */
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> index 5796539..d77d630 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> @@ -33,7 +33,6 @@
> #include "amd_acpi.h"
> #include "atom.h"
>
> -extern void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev);
> /* Call the ATIF method
> */
> /**
> --
> 2.7.4
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


Attachments:
0001-drm-amdgpu-amdgpu_pm_acpi_event_handler-definition-t.patch (1.88 kB)

2016-10-24 16:29:44

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH 1/3] drm/amdgpu: change function declarations and add missing header dependencies

On Mon, Oct 24, 2016 at 5:35 AM, Christian König
<[email protected]> wrote:
> Am 22.10.2016 um 10:48 schrieb Baoyou Xie:
>>
>> We get a few warnings when building kernel with W=1:
>> drivers/gpu/drm/amd/amdgpu/atombios_crtc.c:38:6: warning: no previous
>> prototype for 'amdgpu_atombios_crtc_overscan_setup' [-Wmissing-prototypes]
>> drivers/gpu/drm/amd/amdgpu/dce_v8_0.c:661:6: warning: no previous
>> prototype for 'dce_v8_0_disable_dce' [-Wmissing-prototypes]
>> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:40:5: warning: no previous
>> prototype for 'amdgpu_gfx_scratch_get' [-Wmissing-prototypes]
>> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:62:6: warning: no previous
>> prototype for 'amdgpu_gfx_scratch_free' [-Wmissing-prototypes]
>> ....
>>
>> In fact, these functions are declared in
>> drivers/gpu/drm/amd/amdgpu/atombios_crtc.h
>> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
>> drivers/gpu/drm/amd/amdgpu/dce_v8_0.h
>> drivers/gpu/drm/amd/amdgpu/dce_v10_0.h
>> drivers/gpu/drm/amd/amdgpu/dce_v11_0.h
>> drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h.
>> So this patch adds missing header dependencies.
>>
>> By the way, this patch changes declaration of
>> amdgpu_gfx_parse_disable_cu()
>> to subject to its implement, and clean three function declarations
>> in pp_acpi.h up.
>>
>> Signed-off-by: Baoyou Xie <[email protected]>
>
>
> Patch #2 and #3 of this series is Reviewed-by: Christian König
> <[email protected]>.
>

Alternative for patch 3 just sent out.

> The powerplay part is developed by a different team inside AMD, so it would
> be nice to split that change in a different patch and CC [email protected] on
> it.
>
> This is only nice to have, so feel free to add an Acked-by: Christian König
> <[email protected]> on the current version of the patch as well.

Patches 1 and 2 applied. Thanks!

>
> BTW: Any objections to add Rex into MAINTAINERS for the powerplay component?
> The rather extensive TO list on this trivial patch shows that we clearly
> need to better delegate responsibilities, otherwise people will sooner or
> later start to CC half AMD on fixing a typo :)
>

None here. You can add me as a back up. Rex, any objections?

Alex

> Regards,
> Christian.
>
>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 1 +
>> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 3 ++-
>> drivers/gpu/drm/amd/amdgpu/atombios_crtc.c | 1 +
>> drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 1 +
>> drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 1 +
>> drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 1 +
>> drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c | 1 +
>> drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h | 9 +++------
>> 8 files changed, 11 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
>> index a074edd..01a42b6 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
>> @@ -24,6 +24,7 @@
>> */
>> #include <drm/drmP.h>
>> #include "amdgpu.h"
>> +#include "amdgpu_gfx.h"
>> /*
>> * GPU scratch registers helpers function.
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
>> index 51321e1..abd9432 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
>> @@ -27,6 +27,7 @@
>> int amdgpu_gfx_scratch_get(struct amdgpu_device *adev, uint32_t *reg);
>> void amdgpu_gfx_scratch_free(struct amdgpu_device *adev, uint32_t reg);
>> -unsigned amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se,
>> unsigned max_sh);
>> +void amdgpu_gfx_parse_disable_cu(unsigned int *mask, unsigned int max_se,
>> + unsigned int max_sh);
>> #endif
>> diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
>> b/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
>> index f7d236f..8c9bc75 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
>> @@ -31,6 +31,7 @@
>> #include "atom.h"
>> #include "atom-bits.h"
>> #include "atombios_encoders.h"
>> +#include "atombios_crtc.h"
>> #include "amdgpu_atombios.h"
>> #include "amdgpu_pll.h"
>> #include "amdgpu_connectors.h"
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> index 4108c68..443b35f 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> @@ -31,6 +31,7 @@
>> #include "atombios_encoders.h"
>> #include "amdgpu_pll.h"
>> #include "amdgpu_connectors.h"
>> +#include "dce_v10_0.h"
>> #include "dce/dce_10_0_d.h"
>> #include "dce/dce_10_0_sh_mask.h"
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> index f264b8f..d58638c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> @@ -31,6 +31,7 @@
>> #include "atombios_encoders.h"
>> #include "amdgpu_pll.h"
>> #include "amdgpu_connectors.h"
>> +#include "dce_v11_0.h"
>> #include "dce/dce_11_0_d.h"
>> #include "dce/dce_11_0_sh_mask.h"
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> index 5966166..dd5838c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> @@ -31,6 +31,7 @@
>> #include "atombios_encoders.h"
>> #include "amdgpu_pll.h"
>> #include "amdgpu_connectors.h"
>> +#include "dce_v8_0.h"
>> #include "dce/dce_8_0_d.h"
>> #include "dce/dce_8_0_sh_mask.h"
>> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
>> b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
>> index 1944d28..f5e8fda 100644
>> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
>> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
>> @@ -25,6 +25,7 @@
>> #include "linux/delay.h"
>> #include "hwmgr.h"
>> #include "amd_acpi.h"
>> +#include "pp_acpi.h"
>> bool acpi_atcs_functions_supported(void *device, uint32_t index)
>> {
>> diff --git a/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h
>> b/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h
>> index 3df5de2..8fe8ba9 100644
>> --- a/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h
>> +++ b/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h
>> @@ -21,9 +21,6 @@
>> *
>> */
>> -extern bool acpi_atcs_functions_supported(void *device,
>> - uint32_t index);
>> -extern int acpi_pcie_perf_request(void *device,
>> - uint8_t perf_req,
>> - bool advertise);
>> -extern bool acpi_atcs_notify_pcie_device_ready(void *device);
>> +bool acpi_atcs_functions_supported(void *device, uint32_t index);
>> +int acpi_pcie_perf_request(void *device, uint8_t perf_req, bool
>> advertise);
>> +bool acpi_atcs_notify_pcie_device_ready(void *device);
>
>
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel