Skip to contentSkip to conversation

vfio-mdev: Fix mtty sample driver building

PATCH In review Alex Williamson 3 participants 7 messages Dec 14, 2016 – Dec 15, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfio-mdev: Fix mtty sample driver building

This sample driver was originally under Documentation/ and was moved to samples, but build support was never adjusted for the new location.

---
 samples/Kconfig            |    7 +++++++
 samples/Makefile           |    3 ++-
 samples/vfio-mdev/Makefile |   14 +-------------
 3 files changed, 10 insertions(+), 14 deletions(-)
samples/Kconfig +7 -0
index a6d2a43..b124f62 100644
@@ -105,4 +105,11 @@ config SAMPLE_BLACKFIN_GPTIMERS
 	help
 	  Build samples of blackfin gptimers sample module.
 
+config SAMPLE_VFIO_MDEV_MTTY
+	tristate "Build VFIO mtty example mediated device sample code -- loadable modules only"
+	depends on VFIO_MDEV_DEVICE && m
+	help
+	  Build a virtual tty sample driver for use as a VFIO
+	  mediated device
+
 endif # SAMPLES
samples/Makefile +2 -1
index e17d66d..86a137e 100644
@@ -2,4 +2,5 @@
 
 obj-$(CONFIG_SAMPLES)	+= kobject/ kprobes/ trace_events/ livepatch/ \
 			   hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \
-			   configfs/ connector/ v4l/ trace_printk/ blackfin/
+			   configfs/ connector/ v4l/ trace_printk/ blackfin/ \
+			   vfio-mdev/
samples/vfio-mdev/Makefile +1 -13
index a932edb..cbbd868 100644
@@ -1,13 +1 @@
-#
-# Makefile for mtty.c file
-#
-KERNEL_DIR:=/lib/modules/$(shell uname -r)/build
-
-obj-m:=mtty.o
-
-modules clean modules_install:
-	$(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) $@
-
-default: modules
-
-module: modules
+obj-$(CONFIG_SAMPLE_VFIO_MDEV_MTTY) += mtty.o
maintainer
#1 lore raw
Quoted 10 lines · Alex Williamson

This sample driver was originally under Documentation/ and was moved to samples, but build support was never adjusted for the new location.

---
 samples/Kconfig            |    7 +++++++
 samples/Makefile           |    3 ++-
 samples/vfio-mdev/Makefile |   14 +-------------
 3 files changed, 10 insertions(+), 14 deletions(-)

This change would bring this example driver in Kernel build system if selected. I do have verified build and tested it on x86_64 platform. Have you verified x86 and PPC/ARM build (which I think primarily could use VFIO)?

Thanks,
Kirti

Quoted 47 lines
samples/Kconfig +7 -0
index a6d2a43..b124f62 100644
@@ -105,4 +105,11 @@ config SAMPLE_BLACKFIN_GPTIMERS
 	help
 	  Build samples of blackfin gptimers sample module.
 
+config SAMPLE_VFIO_MDEV_MTTY
+	tristate "Build VFIO mtty example mediated device sample code -- loadable modules only"
+	depends on VFIO_MDEV_DEVICE && m
+	help
+	  Build a virtual tty sample driver for use as a VFIO
+	  mediated device
+
 endif # SAMPLES
samples/Makefile +2 -1
index e17d66d..86a137e 100644
@@ -2,4 +2,5 @@
 
 obj-$(CONFIG_SAMPLES)	+= kobject/ kprobes/ trace_events/ livepatch/ \
 			   hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \
-			   configfs/ connector/ v4l/ trace_printk/ blackfin/
+			   configfs/ connector/ v4l/ trace_printk/ blackfin/ \
+			   vfio-mdev/
samples/vfio-mdev/Makefile +1 -13
index a932edb..cbbd868 100644
@@ -1,13 +1 @@
-#
-# Makefile for mtty.c file
-#
-KERNEL_DIR:=/lib/modules/$(shell uname -r)/build
-
-obj-m:=mtty.o
-
-modules clean modules_install:
-	$(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) $@
-
-default: modules
-
-module: modules
+obj-$(CONFIG_SAMPLE_VFIO_MDEV_MTTY) += mtty.o
#2 lore raw
Quoted 12 lines · On Thu, 15 Dec 2016 13:15:34 +0530 Kirti Wankhede <[email protected]> wrote:
Quoted 10 lines · Alex Williamson

This sample driver was originally under Documentation/ and was moved to samples, but build support was never adjusted for the new location.

---
 samples/Kconfig            |    7 +++++++
 samples/Makefile           |    3 ++-
 samples/vfio-mdev/Makefile |   14 +-------------
 3 files changed, 10 insertions(+), 14 deletions(-)
Quoted 4 lines

This change would bring this example driver in Kernel build system if selected. I do have verified build and tested it on x86_64 platform. Have you verified x86 and PPC/ARM build (which I think primarily could use VFIO)?

I have not, but I'm fairly confident that CONFIG_SAMPLES is not a typical user or distro config option, so I think we're at a low risk of breaking anyone. In general I test almost exclusively for x86_64 and rely on external auto builders to identify issues on other archs. Thanks,

Alex

Quoted 47 lines
Quoted 47 lines
samples/Kconfig +7 -0
index a6d2a43..b124f62 100644
@@ -105,4 +105,11 @@ config SAMPLE_BLACKFIN_GPTIMERS
 	help
 	  Build samples of blackfin gptimers sample module.
 
+config SAMPLE_VFIO_MDEV_MTTY
+	tristate "Build VFIO mtty example mediated device sample code -- loadable modules only"
+	depends on VFIO_MDEV_DEVICE && m
+	help
+	  Build a virtual tty sample driver for use as a VFIO
+	  mediated device
+
 endif # SAMPLES
samples/Makefile +2 -1
index e17d66d..86a137e 100644
@@ -2,4 +2,5 @@
 
 obj-$(CONFIG_SAMPLES)	+= kobject/ kprobes/ trace_events/ livepatch/ \
 			   hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \
-			   configfs/ connector/ v4l/ trace_printk/ blackfin/
+			   configfs/ connector/ v4l/ trace_printk/ blackfin/ \
+			   vfio-mdev/
samples/vfio-mdev/Makefile +1 -13
index a932edb..cbbd868 100644
@@ -1,13 +1 @@
-#
-# Makefile for mtty.c file
-#
-KERNEL_DIR:=/lib/modules/$(shell uname -r)/build
-
-obj-m:=mtty.o
-
-modules clean modules_install:
-	$(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) $@
-
-default: modules
-
-module: modules
+obj-$(CONFIG_SAMPLE_VFIO_MDEV_MTTY) += mtty.o
maintainer Reviewed-by
#3 lore raw
Quoted 20 lines · Alex Williamson
Quoted 12 lines · On Thu, 15 Dec 2016 13:15:34 +0530 Kirti Wankhede <[email protected]> wrote:
Quoted 10 lines · Alex Williamson

This sample driver was originally under Documentation/ and was moved to samples, but build support was never adjusted for the new location.

---
 samples/Kconfig            |    7 +++++++
 samples/Makefile           |    3 ++-
 samples/vfio-mdev/Makefile |   14 +-------------
 3 files changed, 10 insertions(+), 14 deletions(-)
Quoted 4 lines

This change would bring this example driver in Kernel build system if selected. I do have verified build and tested it on x86_64 platform. Have you verified x86 and PPC/ARM build (which I think primarily could use VFIO)?

Quoted 4 lines

I have not, but I'm fairly confident that CONFIG_SAMPLES is not a typical user or distro config option, so I think we're at a low risk of breaking anyone. In general I test almost exclusively for x86_64 and rely on external auto builders to identify issues on other archs.

Ok. I'm fine with this change. Also saw Eric's confirmation on ARM aarch64 compilations. Thanks.

Thanks,
Kirti

Quoted 52 lines

Thanks,

Alex

Quoted 47 lines
Quoted 47 lines
samples/Kconfig +7 -0
index a6d2a43..b124f62 100644
@@ -105,4 +105,11 @@ config SAMPLE_BLACKFIN_GPTIMERS
 	help
 	  Build samples of blackfin gptimers sample module.
 
+config SAMPLE_VFIO_MDEV_MTTY
+	tristate "Build VFIO mtty example mediated device sample code -- loadable modules only"
+	depends on VFIO_MDEV_DEVICE && m
+	help
+	  Build a virtual tty sample driver for use as a VFIO
+	  mediated device
+
 endif # SAMPLES
samples/Makefile +2 -1
index e17d66d..86a137e 100644
@@ -2,4 +2,5 @@
 
 obj-$(CONFIG_SAMPLES)	+= kobject/ kprobes/ trace_events/ livepatch/ \
 			   hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \
-			   configfs/ connector/ v4l/ trace_printk/ blackfin/
+			   configfs/ connector/ v4l/ trace_printk/ blackfin/ \
+			   vfio-mdev/
samples/vfio-mdev/Makefile +1 -13
index a932edb..cbbd868 100644
@@ -1,13 +1 @@
-#
-# Makefile for mtty.c file
-#
-KERNEL_DIR:=/lib/modules/$(shell uname -r)/build
-
-obj-m:=mtty.o
-
-modules clean modules_install:
-	$(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) $@
-
-default: modules
-
-module: modules
+obj-$(CONFIG_SAMPLE_VFIO_MDEV_MTTY) += mtty.o
#4 lore raw
Quoted 26 lines · On Thu, 15 Dec 2016 15:17:46 +0530 Kirti Wankhede <[email protected]> wrote:
Quoted 20 lines · Alex Williamson
Quoted 12 lines · On Thu, 15 Dec 2016 13:15:34 +0530 Kirti Wankhede <[email protected]> wrote:
Quoted 10 lines · Alex Williamson

This sample driver was originally under Documentation/ and was moved to samples, but build support was never adjusted for the new location.

---
 samples/Kconfig            |    7 +++++++
 samples/Makefile           |    3 ++-
 samples/vfio-mdev/Makefile |   14 +-------------
 3 files changed, 10 insertions(+), 14 deletions(-)
Quoted 4 lines

This change would bring this example driver in Kernel build system if selected. I do have verified build and tested it on x86_64 platform. Have you verified x86 and PPC/ARM build (which I think primarily could use VFIO)?

Quoted 4 lines

I have not, but I'm fairly confident that CONFIG_SAMPLES is not a typical user or distro config option, so I think we're at a low risk of breaking anyone. In general I test almost exclusively for x86_64 and rely on external auto builders to identify issues on other archs.

Quoted 4 lines

Ok. I'm fine with this change. Also saw Eric's confirmation on ARM aarch64 compilations. Thanks.

Thanks!

Alex

Quoted 48 lines
Quoted 48 lines
Quoted 47 lines
Quoted 47 lines
samples/Kconfig +7 -0
index a6d2a43..b124f62 100644
@@ -105,4 +105,11 @@ config SAMPLE_BLACKFIN_GPTIMERS
 	help
 	  Build samples of blackfin gptimers sample module.
 
+config SAMPLE_VFIO_MDEV_MTTY
+	tristate "Build VFIO mtty example mediated device sample code -- loadable modules only"
+	depends on VFIO_MDEV_DEVICE && m
+	help
+	  Build a virtual tty sample driver for use as a VFIO
+	  mediated device
+
 endif # SAMPLES
samples/Makefile +2 -1
index e17d66d..86a137e 100644
@@ -2,4 +2,5 @@
 
 obj-$(CONFIG_SAMPLES)	+= kobject/ kprobes/ trace_events/ livepatch/ \
 			   hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \
-			   configfs/ connector/ v4l/ trace_printk/ blackfin/
+			   configfs/ connector/ v4l/ trace_printk/ blackfin/ \
+			   vfio-mdev/
samples/vfio-mdev/Makefile +1 -13
index a932edb..cbbd868 100644
@@ -1,13 +1 @@
-#
-# Makefile for mtty.c file
-#
-KERNEL_DIR:=/lib/modules/$(shell uname -r)/build
-
-obj-m:=mtty.o
-
-modules clean modules_install:
-	$(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) $@
-
-default: modules
-
-module: modules
+obj-$(CONFIG_SAMPLE_VFIO_MDEV_MTTY) += mtty.o
Reviewed-by Tested-by on v1 1/1
#5 lore raw
In reply to Alex Williamson

Hi,

Quoted 46 lines · Alex Williamson

This sample driver was originally under Documentation/ and was moved to samples, but build support was never adjusted for the new location.

---
 samples/Kconfig            |    7 +++++++
 samples/Makefile           |    3 ++-
 samples/vfio-mdev/Makefile |   14 +-------------
 3 files changed, 10 insertions(+), 14 deletions(-)
samples/Kconfig +7 -0
index a6d2a43..b124f62 100644
@@ -105,4 +105,11 @@ config SAMPLE_BLACKFIN_GPTIMERS
 	help
 	  Build samples of blackfin gptimers sample module.
 
+config SAMPLE_VFIO_MDEV_MTTY
+	tristate "Build VFIO mtty example mediated device sample code -- loadable modules only"
+	depends on VFIO_MDEV_DEVICE && m
+	help
+	  Build a virtual tty sample driver for use as a VFIO
+	  mediated device
+
 endif # SAMPLES
samples/Makefile +2 -1
index e17d66d..86a137e 100644
@@ -2,4 +2,5 @@
 
 obj-$(CONFIG_SAMPLES)	+= kobject/ kprobes/ trace_events/ livepatch/ \
 			   hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \
-			   configfs/ connector/ v4l/ trace_printk/ blackfin/
+			   configfs/ connector/ v4l/ trace_printk/ blackfin/ \
+			   vfio-mdev/
samples/vfio-mdev/Makefile +0 -4
index a932edb..cbbd868 100644
@@ -1,13 +1 @@
-#
-# Makefile for mtty.c file
-#
-KERNEL_DIR:=/lib/modules/$(shell uname -r)/build

samples/vfio-mdev/Makefile line 1

Quoted 10 lines
samples/vfio-mdev/Makefile +1 -9
-
-obj-m:=mtty.o
-
-modules clean modules_install:
-	$(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) $@
-
-default: modules
-
-module: modules
+obj-$(CONFIG_SAMPLE_VFIO_MDEV_MTTY) += mtty.o

Test-compiled on ARM aarch64

Best Regards

Eric

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
Quoted 62 lines · On Thu, 15 Dec 2016 10:36:02 +0100 Auger Eric <[email protected]> wrote:

Hi,

Quoted 46 lines · Alex Williamson

This sample driver was originally under Documentation/ and was moved to samples, but build support was never adjusted for the new location.

---
 samples/Kconfig            |    7 +++++++
 samples/Makefile           |    3 ++-
 samples/vfio-mdev/Makefile |   14 +-------------
 3 files changed, 10 insertions(+), 14 deletions(-)
samples/Kconfig +7 -0
index a6d2a43..b124f62 100644
@@ -105,4 +105,11 @@ config SAMPLE_BLACKFIN_GPTIMERS
 	help
 	  Build samples of blackfin gptimers sample module.
 
+config SAMPLE_VFIO_MDEV_MTTY
+	tristate "Build VFIO mtty example mediated device sample code -- loadable modules only"
+	depends on VFIO_MDEV_DEVICE && m
+	help
+	  Build a virtual tty sample driver for use as a VFIO
+	  mediated device
+
 endif # SAMPLES
samples/Makefile +2 -1
index e17d66d..86a137e 100644
@@ -2,4 +2,5 @@
 
 obj-$(CONFIG_SAMPLES)	+= kobject/ kprobes/ trace_events/ livepatch/ \
 			   hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \
-			   configfs/ connector/ v4l/ trace_printk/ blackfin/
+			   configfs/ connector/ v4l/ trace_printk/ blackfin/ \
+			   vfio-mdev/
samples/vfio-mdev/Makefile +0 -4
index a932edb..cbbd868 100644
@@ -1,13 +1 @@
-#
-# Makefile for mtty.c file
-#
-KERNEL_DIR:=/lib/modules/$(shell uname -r)/build

samples/vfio-mdev/Makefile line 1

Quoted 10 lines
samples/vfio-mdev/Makefile +1 -9
-
-obj-m:=mtty.o
-
-modules clean modules_install:
-	$(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) $@
-
-default: modules
-
-module: modules
+obj-$(CONFIG_SAMPLE_VFIO_MDEV_MTTY) += mtty.o  

Test-compiled on ARM aarch64

Quoted 2 lines

Thanks for both!

Alex