diff mbox series

[v2] platform/x86: Move AMD platform drivers to separate directory

Message ID 20220608182019.2810125-1-Shyam-sundar.S-k@amd.com (mailing list archive)
State Superseded, archived
Headers show
Series [v2] platform/x86: Move AMD platform drivers to separate directory | expand

Commit Message

Shyam Sundar S K June 8, 2022, 6:20 p.m. UTC
Currently, AMD supported platform drivers are grouped under generic "x86"
folder structure. Move the current drivers (amd-pmc and amd_hsmp) to a
separate directory. This would also mean the newer driver submissions to
pdx86 subsystem in the future will also land in AMD specific directory.

Reviewed-by: Naveen Krishna Chatradhi <NaveenKrishna.Chatradhi@amd.com>
Tested-by: Suma Hegde <suma.hegde@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
v2:
  - drop "amd" prefix from the file names

 MAINTAINERS                                   |  4 +--
 drivers/platform/x86/Kconfig                  | 27 +---------------
 drivers/platform/x86/Makefile                 |  3 +-
 drivers/platform/x86/amd/Kconfig              | 31 +++++++++++++++++++
 drivers/platform/x86/amd/Makefile             |  9 ++++++
 .../platform/x86/{amd_hsmp.c => amd/hsmp.c}   |  0
 drivers/platform/x86/{amd-pmc.c => amd/pmc.c} |  0
 7 files changed, 44 insertions(+), 30 deletions(-)
 create mode 100644 drivers/platform/x86/amd/Kconfig
 create mode 100644 drivers/platform/x86/amd/Makefile
 rename drivers/platform/x86/{amd_hsmp.c => amd/hsmp.c} (100%)
 rename drivers/platform/x86/{amd-pmc.c => amd/pmc.c} (100%)

Comments

Shyam Sundar S K June 8, 2022, 6:25 p.m. UTC | #1
Adding Andy..

On 6/8/2022 11:50 PM, Shyam Sundar S K wrote:
> Currently, AMD supported platform drivers are grouped under generic "x86"
> folder structure. Move the current drivers (amd-pmc and amd_hsmp) to a
> separate directory. This would also mean the newer driver submissions to
> pdx86 subsystem in the future will also land in AMD specific directory.
> 
> Reviewed-by: Naveen Krishna Chatradhi <NaveenKrishna.Chatradhi@amd.com>
> Tested-by: Suma Hegde <suma.hegde@amd.com>
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
> ---
> v2:
>   - drop "amd" prefix from the file names
> 
>  MAINTAINERS                                   |  4 +--
>  drivers/platform/x86/Kconfig                  | 27 +---------------
>  drivers/platform/x86/Makefile                 |  3 +-
>  drivers/platform/x86/amd/Kconfig              | 31 +++++++++++++++++++
>  drivers/platform/x86/amd/Makefile             |  9 ++++++
>  .../platform/x86/{amd_hsmp.c => amd/hsmp.c}   |  0
>  drivers/platform/x86/{amd-pmc.c => amd/pmc.c} |  0
>  7 files changed, 44 insertions(+), 30 deletions(-)
>  create mode 100644 drivers/platform/x86/amd/Kconfig
>  create mode 100644 drivers/platform/x86/amd/Makefile
>  rename drivers/platform/x86/{amd_hsmp.c => amd/hsmp.c} (100%)
>  rename drivers/platform/x86/{amd-pmc.c => amd/pmc.c} (100%)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index a6d3bd9d2a8d..2a34deb24594 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -996,7 +996,7 @@ AMD PMC DRIVER
>  M:	Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
>  L:	platform-driver-x86@vger.kernel.org
>  S:	Maintained
> -F:	drivers/platform/x86/amd-pmc.*
> +F:	drivers/platform/x86/amd/pmc.c
>  
>  AMD HSMP DRIVER
>  M:	Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
> @@ -1006,7 +1006,7 @@ S:	Maintained
>  F:	Documentation/x86/amd_hsmp.rst
>  F:	arch/x86/include/asm/amd_hsmp.h
>  F:	arch/x86/include/uapi/asm/amd_hsmp.h
> -F:	drivers/platform/x86/amd_hsmp.c
> +F:	drivers/platform/x86/amd/hsmp.c
>  
>  AMD POWERPLAY AND SWSMU
>  M:	Evan Quan <evan.quan@amd.com>
> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> index f08ad85683cb..b1879980ce2e 100644
> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -196,32 +196,7 @@ config ACER_WMI
>  	  If you have an ACPI-WMI compatible Acer/ Wistron laptop, say Y or M
>  	  here.
>  
> -config AMD_PMC
> -	tristate "AMD SoC PMC driver"
> -	depends on ACPI && PCI && RTC_CLASS
> -	help
> -	  The driver provides support for AMD Power Management Controller
> -	  primarily responsible for S2Idle transactions that are driven from
> -	  a platform firmware running on SMU. This driver also provides a debug
> -	  mechanism to investigate the S2Idle transactions and failures.
> -
> -	  Say Y or M here if you have a notebook powered by AMD RYZEN CPU/APU.
> -
> -	  If you choose to compile this driver as a module the module will be
> -	  called amd-pmc.
> -
> -config AMD_HSMP
> -	tristate "AMD HSMP Driver"
> -	depends on AMD_NB && X86_64
> -	help
> -	  The driver provides a way for user space tools to monitor and manage
> -	  system management functionality on EPYC server CPUs from AMD.
> -
> -	  Host System Management Port (HSMP) interface is a mailbox interface
> -	  between the x86 core and the System Management Unit (SMU) firmware.
> -
> -	  If you choose to compile this driver as a module the module will be
> -	  called amd_hsmp.
> +source "drivers/platform/x86/amd/Kconfig"
>  
>  config ADV_SWBUTTON
>  	tristate "Advantech ACPI Software Button Driver"
> diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
> index 4a59f47a46e2..48abfe50aaf5 100644
> --- a/drivers/platform/x86/Makefile
> +++ b/drivers/platform/x86/Makefile
> @@ -23,8 +23,7 @@ obj-$(CONFIG_ACER_WIRELESS)	+= acer-wireless.o
>  obj-$(CONFIG_ACER_WMI)		+= acer-wmi.o
>  
>  # AMD
> -obj-$(CONFIG_AMD_PMC)		+= amd-pmc.o
> -obj-$(CONFIG_AMD_HSMP)		+= amd_hsmp.o
> +obj-y				+= amd/
>  
>  # Advantech
>  obj-$(CONFIG_ADV_SWBUTTON)	+= adv_swbutton.o
> diff --git a/drivers/platform/x86/amd/Kconfig b/drivers/platform/x86/amd/Kconfig
> new file mode 100644
> index 000000000000..c0d0a3c5170c
> --- /dev/null
> +++ b/drivers/platform/x86/amd/Kconfig
> @@ -0,0 +1,31 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +#
> +# AMD x86 Platform Specific Drivers
> +#
> +
> +config AMD_PMC
> +	tristate "AMD SoC PMC driver"
> +	depends on ACPI && PCI && RTC_CLASS
> +	help
> +	  The driver provides support for AMD Power Management Controller
> +	  primarily responsible for S2Idle transactions that are driven from
> +	  a platform firmware running on SMU. This driver also provides a debug
> +	  mechanism to investigate the S2Idle transactions and failures.
> +
> +	  Say Y or M here if you have a notebook powered by AMD RYZEN CPU/APU.
> +
> +	  If you choose to compile this driver as a module the module will be
> +	  called amd-pmc.
> +
> +config AMD_HSMP
> +	tristate "AMD HSMP Driver"
> +	depends on AMD_NB && X86_64
> +	help
> +	  The driver provides a way for user space tools to monitor and manage
> +	  system management functionality on EPYC server CPUs from AMD.
> +
> +	  Host System Management Port (HSMP) interface is a mailbox interface
> +	  between the x86 core and the System Management Unit (SMU) firmware.
> +
> +	  If you choose to compile this driver as a module the module will be
> +	  called amd_hsmp.
> diff --git a/drivers/platform/x86/amd/Makefile b/drivers/platform/x86/amd/Makefile
> new file mode 100644
> index 000000000000..de1604993309
> --- /dev/null
> +++ b/drivers/platform/x86/amd/Makefile
> @@ -0,0 +1,9 @@
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# Makefile for drivers/platform/x86/amd
> +# AMD x86 Platform-Specific Drivers
> +#
> +
> +obj-$(CONFIG_AMD_PMC)		+= pmc.o
> +obj-$(CONFIG_AMD_HSMP)		+= hsmp.o
> +
> diff --git a/drivers/platform/x86/amd_hsmp.c b/drivers/platform/x86/amd/hsmp.c
> similarity index 100%
> rename from drivers/platform/x86/amd_hsmp.c
> rename to drivers/platform/x86/amd/hsmp.c
> diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd/pmc.c
> similarity index 100%
> rename from drivers/platform/x86/amd-pmc.c
> rename to drivers/platform/x86/amd/pmc.c
>
Andy Shevchenko June 8, 2022, 6:41 p.m. UTC | #2
On Wed, Jun 8, 2022 at 8:23 PM Shyam Sundar S K
<Shyam-sundar.S-k@amd.com> wrote:
>
> Currently, AMD supported platform drivers are grouped under generic "x86"
> folder structure. Move the current drivers (amd-pmc and amd_hsmp) to a
> separate directory. This would also mean the newer driver submissions to
> pdx86 subsystem in the future will also land in AMD specific directory.

...

> +obj-$(CONFIG_AMD_PMC)          += pmc.o
> +obj-$(CONFIG_AMD_HSMP)         += hsmp.o

This will make a potential collision if there will be a module with
the same name, but in a different folder.  Also this breaks a kernel
command line (in case of built-in). Dunno if the latter is important,
though.

I mentioned a trick that has been used in drivers/platform/x86/intel/Makefile.
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index a6d3bd9d2a8d..2a34deb24594 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -996,7 +996,7 @@  AMD PMC DRIVER
 M:	Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
 L:	platform-driver-x86@vger.kernel.org
 S:	Maintained
-F:	drivers/platform/x86/amd-pmc.*
+F:	drivers/platform/x86/amd/pmc.c
 
 AMD HSMP DRIVER
 M:	Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
@@ -1006,7 +1006,7 @@  S:	Maintained
 F:	Documentation/x86/amd_hsmp.rst
 F:	arch/x86/include/asm/amd_hsmp.h
 F:	arch/x86/include/uapi/asm/amd_hsmp.h
-F:	drivers/platform/x86/amd_hsmp.c
+F:	drivers/platform/x86/amd/hsmp.c
 
 AMD POWERPLAY AND SWSMU
 M:	Evan Quan <evan.quan@amd.com>
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index f08ad85683cb..b1879980ce2e 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -196,32 +196,7 @@  config ACER_WMI
 	  If you have an ACPI-WMI compatible Acer/ Wistron laptop, say Y or M
 	  here.
 
-config AMD_PMC
-	tristate "AMD SoC PMC driver"
-	depends on ACPI && PCI && RTC_CLASS
-	help
-	  The driver provides support for AMD Power Management Controller
-	  primarily responsible for S2Idle transactions that are driven from
-	  a platform firmware running on SMU. This driver also provides a debug
-	  mechanism to investigate the S2Idle transactions and failures.
-
-	  Say Y or M here if you have a notebook powered by AMD RYZEN CPU/APU.
-
-	  If you choose to compile this driver as a module the module will be
-	  called amd-pmc.
-
-config AMD_HSMP
-	tristate "AMD HSMP Driver"
-	depends on AMD_NB && X86_64
-	help
-	  The driver provides a way for user space tools to monitor and manage
-	  system management functionality on EPYC server CPUs from AMD.
-
-	  Host System Management Port (HSMP) interface is a mailbox interface
-	  between the x86 core and the System Management Unit (SMU) firmware.
-
-	  If you choose to compile this driver as a module the module will be
-	  called amd_hsmp.
+source "drivers/platform/x86/amd/Kconfig"
 
 config ADV_SWBUTTON
 	tristate "Advantech ACPI Software Button Driver"
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index 4a59f47a46e2..48abfe50aaf5 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -23,8 +23,7 @@  obj-$(CONFIG_ACER_WIRELESS)	+= acer-wireless.o
 obj-$(CONFIG_ACER_WMI)		+= acer-wmi.o
 
 # AMD
-obj-$(CONFIG_AMD_PMC)		+= amd-pmc.o
-obj-$(CONFIG_AMD_HSMP)		+= amd_hsmp.o
+obj-y				+= amd/
 
 # Advantech
 obj-$(CONFIG_ADV_SWBUTTON)	+= adv_swbutton.o
diff --git a/drivers/platform/x86/amd/Kconfig b/drivers/platform/x86/amd/Kconfig
new file mode 100644
index 000000000000..c0d0a3c5170c
--- /dev/null
+++ b/drivers/platform/x86/amd/Kconfig
@@ -0,0 +1,31 @@ 
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# AMD x86 Platform Specific Drivers
+#
+
+config AMD_PMC
+	tristate "AMD SoC PMC driver"
+	depends on ACPI && PCI && RTC_CLASS
+	help
+	  The driver provides support for AMD Power Management Controller
+	  primarily responsible for S2Idle transactions that are driven from
+	  a platform firmware running on SMU. This driver also provides a debug
+	  mechanism to investigate the S2Idle transactions and failures.
+
+	  Say Y or M here if you have a notebook powered by AMD RYZEN CPU/APU.
+
+	  If you choose to compile this driver as a module the module will be
+	  called amd-pmc.
+
+config AMD_HSMP
+	tristate "AMD HSMP Driver"
+	depends on AMD_NB && X86_64
+	help
+	  The driver provides a way for user space tools to monitor and manage
+	  system management functionality on EPYC server CPUs from AMD.
+
+	  Host System Management Port (HSMP) interface is a mailbox interface
+	  between the x86 core and the System Management Unit (SMU) firmware.
+
+	  If you choose to compile this driver as a module the module will be
+	  called amd_hsmp.
diff --git a/drivers/platform/x86/amd/Makefile b/drivers/platform/x86/amd/Makefile
new file mode 100644
index 000000000000..de1604993309
--- /dev/null
+++ b/drivers/platform/x86/amd/Makefile
@@ -0,0 +1,9 @@ 
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for drivers/platform/x86/amd
+# AMD x86 Platform-Specific Drivers
+#
+
+obj-$(CONFIG_AMD_PMC)		+= pmc.o
+obj-$(CONFIG_AMD_HSMP)		+= hsmp.o
+
diff --git a/drivers/platform/x86/amd_hsmp.c b/drivers/platform/x86/amd/hsmp.c
similarity index 100%
rename from drivers/platform/x86/amd_hsmp.c
rename to drivers/platform/x86/amd/hsmp.c
diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd/pmc.c
similarity index 100%
rename from drivers/platform/x86/amd-pmc.c
rename to drivers/platform/x86/amd/pmc.c