Skip to contentSkip to conversation

drivers/virt: introduce Freescale hypervisor management driver

PATCH Superseded Timur Tabi 4 participants 21 messages Jun 8, 2011 – Jun 10, 2011 virtio core

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Timur Tabi

author
#0 lore raw

PATCH v4 7/7 drivers/virt: introduce Freescale hypervisor management driver

Add the drivers/virt directory, which houses drivers that support virtualization environments, and add the Freescale hypervisor management driver.

The Freescale hypervisor management driver provides several services to drivers and applications related to the Freescale hypervisor:

1. An ioctl interface for querying and managing partitions

2. A file interface to reading incoming doorbells

3. An interrupt handler for shutting down the partition upon receiving the shutdown doorbell from a manager partition

4. An interface for receiving callbacks when a managed partition shuts down.

---
 drivers/Kconfig                |    2 +
 drivers/Makefile               |    3 +
 drivers/virt/Kconfig           |   22 +
 drivers/virt/Makefile          |    5 +
 drivers/virt/fsl_hypervisor.c  |  961 ++++++++++++++++++++++++++++++++++++++++
 include/linux/Kbuild           |    1 +
 include/linux/fsl_hypervisor.h |  214 +++++++++
 7 files changed, 1208 insertions(+), 0 deletions(-)
 create mode 100644 drivers/virt/Kconfig
 create mode 100644 drivers/virt/Makefile
 create mode 100644 drivers/virt/fsl_hypervisor.c
 create mode 100644 include/linux/fsl_hypervisor.h
drivers/Kconfig +2 -0
index 557a469..0371680 100644
@@ -122,4 +122,6 @@ source "drivers/hwspinlock/Kconfig"
 
 source "drivers/clocksource/Kconfig"
 
+source "drivers/virt/Kconfig"
+
 endmenu
drivers/Makefile +3 -0
index 3f135b6..306c80e5 100644
@@ -119,3 +119,6 @@ obj-y				+= ieee802154/
 obj-y				+= clk/
 
 obj-$(CONFIG_HWSPINLOCK)	+= hwspinlock/
+
+# Virtualization drivers
+obj-$(VIRT_DRIVERS)		+= virt/
drivers/virt/Kconfig new file +22 -0
new file mode 100644
index 0000000..b0cb0b6
@@ -0,0 +1,22 @@
+#
+# Virtualization support drivers
+#
+
+menuconfig VIRT_DRIVERS
+	bool "Virtualization drivers"
+	---help---
+	  Say Y here to get to see options for device drivers that support
+	  virtualization environments.
+
+	  If you say N, all options in this submenu will be skipped and disabled.
+
+if VIRT_DRIVERS
+
+config FSL_HV_MANAGER
+	tristate "Freescale hypervisor management driver"
+	depends on FSL_SOC
+	help
+	  This driver allows applications to communicate with the Freescale
+	  Hypervisor.
+
+endif
drivers/virt/Makefile new file +5 -0
new file mode 100644
index 0000000..c47f04d
@@ -0,0 +1,5 @@
+#
+# Makefile for drivers that support virtualization
+#
+
+obj-$(CONFIG_FSL_HV_MANAGER)	+= fsl_hypervisor.o
drivers/virt/fsl_hypervisor.c new file +961 -0

961 lines not on this page · raw message

include/linux/Kbuild +1 -0
index 75cf611..68c341a 100644
@@ -134,6 +134,7 @@ header-y += firewire-cdev.h
 header-y += firewire-constants.h
 header-y += flat.h
 header-y += fs.h
+header-y += fsl_hypervisor.h
 header-y += fuse.h
 header-y += futex.h
 header-y += gameport.h
include/linux/fsl_hypervisor.h new file +214 -0

214 lines not on this page · raw message

Signature · 1 line
1.7.3.4
#1 lore raw
Quoted 3 lines · On Wed, 8 Jun 2011 17:45:54 -0500 Timur Tabi wrote:

Add the drivers/virt directory, which houses drivers that support virtualization environments, and add the Freescale hypervisor management driver.

It can't go in linux/virt or linux/virt/fsl instead? why drivers/ ?

or maybe linux/virt should be drivers/virt ?

Quoted 45 lines

The Freescale hypervisor management driver provides several services to drivers and applications related to the Freescale hypervisor:

1. An ioctl interface for querying and managing partitions

2. A file interface to reading incoming doorbells

3. An interrupt handler for shutting down the partition upon receiving the shutdown doorbell from a manager partition

4. An interface for receiving callbacks when a managed partition shuts down.

---
 drivers/Kconfig                |    2 +
 drivers/Makefile               |    3 +
 drivers/virt/Kconfig           |   22 +
 drivers/virt/Makefile          |    5 +
 drivers/virt/fsl_hypervisor.c  |  961 ++++++++++++++++++++++++++++++++++++++++
 include/linux/Kbuild           |    1 +
 include/linux/fsl_hypervisor.h |  214 +++++++++
 7 files changed, 1208 insertions(+), 0 deletions(-)
 create mode 100644 drivers/virt/Kconfig
 create mode 100644 drivers/virt/Makefile
 create mode 100644 drivers/virt/fsl_hypervisor.c
 create mode 100644 include/linux/fsl_hypervisor.h
include/linux/fsl_hypervisor.h new file +11 -0
new file mode 100644
index 0000000..4d1e11a
@@ -0,0 +1,214 @@
+/*
+ * Freescale hypervisor ioctl interface
+ *
+ * Copyright (C) 2008-2011 Freescale Semiconductor, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the

include/linux/fsl_hypervisor.h line 21

Quoted 10 lines
include/linux/fsl_hypervisor.h new file +10 -0
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Freescale Semiconductor nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.

Why any later version? I thought that <powers> decided that Linux is GPL v2.

Quoted 14 lines
include/linux/fsl_hypervisor.h new file +14 -0
+ *
+ * This software is provided by Freescale Semiconductor "as is" and any
+ * express or implied warranties, including, but not limited to, the implied
+ * warranties of merchantability and fitness for a particular purpose are
+ * disclaimed. In no event shall Freescale Semiconductor be liable for any
+ * direct, indirect, incidental, special, exemplary, or consequential damages
+ * (including, but not limited to, procurement of substitute goods or services;
+ * loss of use, data, or profits; or business interruption) however caused and
+ * on any theory of liability, whether in contract, strict liability, or tort
+ * (including negligence or otherwise) arising in any way out of the use of this
+ * software, even if advised of the possibility of such damage.
+ *
+ * This file is used by the Freescale hypervisor management driver.  It can
+ * also be included by applications that need to communicate with the driver

include/linux/fsl_hypervisor.h line 45

Quoted 10 lines
include/linux/fsl_hypervisor.h new file +10 -0
+ * via the ioctl interface.
+ */
+
+#ifndef FSL_HYPERVISOR_H
+#define FSL_HYPERVISOR_H
+
+#include <linux/types.h>
+
+/**
+ * struct fsl_hv_ioctl_restart: restart a partition

This syntax should be (for all structs here):

* struct fsl_hv_ioctl_restart - restart a partition

but the struct fields/members do use ':' instead of '-'.

Darn, I checked Documentation/kernel-doc-nano-HOWTO.txt and it says that ':' is optional but '-' is needed, so you could use

* struct fsl_hv_ioctl_restart: - restart a partition

Quoted 145 lines
include/linux/fsl_hypervisor.h new file +145 -0
+ * @ret: return error code from the hypervisor
+ * @partition: the ID of the partition to restart, or -1 for the
+ *             calling partition
+ *
+ * Used by FSL_HV_IOCTL_PARTITION_RESTART
+ */
+struct fsl_hv_ioctl_restart {
+	__u32 ret;
+	__u32 partition;
+};
+
+/**
+ * struct fsl_hv_ioctl_status: get a partition's status
+ * @ret: return error code from the hypervisor
+ * @partition: the ID of the partition to query, or -1 for the
+ *             calling partition
+ * @status: The returned status of the partition
+ *
+ * Used by FSL_HV_IOCTL_PARTITION_GET_STATUS
+ *
+ * Values of 'status':
+ *    0 = Stopped
+ *    1 = Running
+ *    2 = Starting
+ *    3 = Stopping
+ */
+struct fsl_hv_ioctl_status {
+	__u32 ret;
+	__u32 partition;
+	__u32 status;
+};
+
+/**
+ * struct fsl_hv_ioctl_start: start a partition
+ * @ret: return error code from the hypervisor
+ * @partition: the ID of the partition to control
+ * @entry_point: The offset within the guest IMA to start execution
+ * @load: If non-zero, reload the partition's images before starting
+ *
+ * Used by FSL_HV_IOCTL_PARTITION_START
+ */
+struct fsl_hv_ioctl_start {
+	__u32 ret;
+	__u32 partition;
+	__u32 entry_point;
+	__u32 load;
+};
+
+/**
+ * struct fsl_hv_ioctl_stop: stop a partition
+ * @ret: return error code from the hypervisor
+ * @partition: the ID of the partition to stop, or -1 for the calling
+ *             partition
+ *
+ * Used by FSL_HV_IOCTL_PARTITION_STOP
+ */
+struct fsl_hv_ioctl_stop {
+	__u32 ret;
+	__u32 partition;
+};
+
+/**
+ * struct fsl_hv_ioctl_memcpy: copy memory between partitions
+ * @ret: return error code from the hypervisor
+ * @source: the partition ID of the source partition, or -1 for this
+ *          partition
+ * @target: the partition ID of the target partition, or -1 for this
+ *          partition
+ * @local_addr: user-space virtual address of a buffer in the local
+ *              partition
+ * @remote_addr: guest physical address of a buffer in the
+ *           remote partition
+ * @count: the number of bytes to copy.  Both the local and remote
+ *         buffers must be at least 'count' bytes long
+ *
+ * Used by FSL_HV_IOCTL_MEMCPY
+ *
+ * The 'local' partition is the partition that calls this ioctl.  The
+ * 'remote' partition is a different partition.  The data is copied from
+ * the 'source' paritition' to the 'target' partition.
+ *
+ * The buffer in the remote partition must be guest physically
+ * contiguous.
+ *
+ * This ioctl does not support copying memory between two remote
+ * partitions or within the same partition, so either 'source' or
+ * 'target' (but not both) must be -1.  In other words, either
+ *
+ *      source == local and target == remote
+ * or
+ *      source == remote and target == local
+ */
+struct fsl_hv_ioctl_memcpy {
+	__u32 ret;
+	__u32 source;
+	__u32 target;
+	__u64 local_vaddr;
+	__u64 remote_paddr;
+	__u64 count;
+};
+
+/**
+ * struct fsl_hv_ioctl_doorbell: ring a doorbell
+ * @ret: return error code from the hypervisor
+ * @doorbell: the handle of the doorbell to ring doorbell
+ *
+ * Used by FSL_HV_IOCTL_DOORBELL
+ */
+struct fsl_hv_ioctl_doorbell {
+	__u32 ret;
+	__u32 doorbell;
+};
+
+/**
+ * struct fsl_hv_ioctl_prop: get/set a device tree property
+ * @ret: return error code from the hypervisor
+ * @handle: handle of partition whose tree to access
+ * @path: virtual address of path name of node to access
+ * @propname: virtual address of name of property to access
+ * @propval: virtual address of property data buffer
+ * @proplen: Size of property data buffer
+ *
+ * Used by FSL_HV_IOCTL_DOORBELL
+ */
+struct fsl_hv_ioctl_prop {
+	__u32 ret;
+	__u32 handle;
+	__u64 path;
+	__u64 propname;
+	__u64 propval;
+	__u32 proplen;
+};
+
+/*
+ * ioctl commands.
+ */
+enum {
+	FSL_HV_IOCTL_PARTITION_RESTART = 1, /* Boot another partition */
+	FSL_HV_IOCTL_PARTITION_GET_STATUS = 2, /* Boot another partition */
+	FSL_HV_IOCTL_PARTITION_START = 3, /* Boot another partition */
+	FSL_HV_IOCTL_PARTITION_STOP = 4, /* Stop this or another partition */
+	FSL_HV_IOCTL_MEMCPY = 5, /* Copy data from one partition to another */
+	FSL_HV_IOCTL_DOORBELL = 6, /* Ring a doorbell */
+
+	/* Get a property from another guest's device tree */

include/linux/fsl_hypervisor.h line 200

Quoted 10 lines
include/linux/fsl_hypervisor.h new file +10 -0
+	FSL_HV_IOCTL_GETPROP = 7,
+
+	/* Set a property in another guest's device tree */
+	FSL_HV_IOCTL_SETPROP = 8,
+};
+
+#ifdef __KERNEL__
+
+/**
+ * fsl_hv_event_register -- register a callback for failover events

Documentation/kernel-doc-nano-HOWTO.txt says to use one '-' here, not 2.

include/linux/fsl_hypervisor.h line 208

Quoted 8 lines
include/linux/fsl_hypervisor.h new file +8 -0
+ *
+ * This function is called by device drivers to register their callback
+ * functions for fail-over events.
+ */
+int fsl_hv_failover_register(struct notifier_block *nb);
+
+/**
+ * fsl_hv_event_unregister -- unregister a callback for failover events

ditto.
And function arg descriptions are missing for both of these functions.

include/linux/fsl_hypervisor.h line 214

Quoted 7 lines
include/linux/fsl_hypervisor.h new file +6 -0
+ */
+int fsl_hv_failover_unregister(struct notifier_block *nb);
+
+#endif
+
+#endif

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

author
#2 lore raw
Quoted 7 lines · Randy Dunlap
Quoted 3 lines

Add the drivers/virt directory, which houses drivers that support

Quoted 2 lines

virtualization environments, and add the Freescale hypervisor management driver.

It can't go in linux/virt or linux/virt/fsl instead? why drivers/ ?

or maybe linux/virt should be drivers/virt ?

I knew this would happen. The reason I put it in drivers/virt is because Arnd told me to put it there. At this point, I don't give a damn where it goes, but I wish you all would come to a consensus.

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.

Why any later version? I thought that <powers> decided that Linux is GPL v2.

Um, you do realize that this isn't the only file in the kernel that is v2-or-later? Try this command on the Linux source, and you'll see what I mean:

grep -r "\(at your option\)" *

I'm dual-licensing the header file because it's meant for applications as well as the kernel. That way, no one needs to worry whether #including the header file in his application will taint the app with the GPL.

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

+/**
+ * struct fsl_hv_ioctl_restart: restart a partition

This syntax should be (for all structs here):

Quoted 9 lines

* struct fsl_hv_ioctl_restart - restart a partition

but the struct fields/members do use ':' instead of '-'.

Darn, I checked Documentation/kernel-doc-nano-HOWTO.txt and it says that ':' is optional but '-' is needed, so you could use

* struct fsl_hv_ioctl_restart: - restart a partition

Ok, I'll change it.

Quoted 3 lines
Quoted 1 line
Quoted 1 line

+ * fsl_hv_event_register -- register a callback for failover events

Documentation/kernel-doc-nano-HOWTO.txt says to use one '-' here, not 2.

Ok. I'll review that document and make sure my comments conform. I guess I just wasn't paying attention at the time.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#17 lore raw
In reply to Timur Tabi
Quoted 7 lines · On Thursday 09 June 2011 00:45:54 Timur Tabi wrote:
include/linux/fsl_hypervisor.h new file +7 -0
+struct fsl_hv_ioctl_memcpy {
+       __u32 ret;
+       __u32 source;
+       __u32 target;
+       __u64 local_vaddr;
+       __u64 remote_paddr;
+       __u64 count;

include/linux/fsl_hypervisor.h line 177

Quoted 10 lines
include/linux/fsl_hypervisor.h new file +9 -0
+};
 
+struct fsl_hv_ioctl_prop {
+       __u32 ret;
+       __u32 handle;
+       __u64 path;
+       __u64 propname;
+       __u64 propval;
+       __u32 proplen;
+};

These structures have implied padding. Better make it explicit by adding the appropriate __u32 __pad1 members or similar.

Quoted 7 lines
include/linux/fsl_hypervisor.h new file +7 -0
+/*
+ * ioctl commands.
+ */
+enum {
+       FSL_HV_IOCTL_PARTITION_RESTART = 1, /* Boot another partition */
+       FSL_HV_IOCTL_PARTITION_GET_STATUS = 2, /* Boot another partition */
+       FSL_HV_IOCTL_PARTITION_START = 3, /* Boot another partition */

include/linux/fsl_hypervisor.h line 195

Quoted 10 lines
include/linux/fsl_hypervisor.h new file +10 -0
+       FSL_HV_IOCTL_PARTITION_STOP = 4, /* Stop this or another partition */
+       FSL_HV_IOCTL_MEMCPY = 5, /* Copy data from one partition to another */
+       FSL_HV_IOCTL_DOORBELL = 6, /* Ring a doorbell */
+
+       /* Get a property from another guest's device tree */
+       FSL_HV_IOCTL_GETPROP = 7,
+
+       /* Set a property in another guest's device tree */
+       FSL_HV_IOCTL_SETPROP = 8,
+};

As discussed before, this one should really be using the _IOC macros to define the commands that you use based on the structure definitions above, e.g.

#define FSL_HV_IOCTL_GETPROP _IORW(FSL_HV, 8, struct fsl_hv_ioctl_prop)

Then get rid of all the code that takes apart the ioctl command numbers again and just do a switch/case based on the command.

Arnd

Arnd

#3 lore raw
In reply to Randy Dunlap
Quoted 9 lines · On Thursday 09 June 2011 01:10:09 Randy Dunlap wrote:
Quoted 3 lines · On Wed, 8 Jun 2011 17:45:54 -0500 Timur Tabi wrote:

Add the drivers/virt directory, which houses drivers that support virtualization environments, and add the Freescale hypervisor management driver.

It can't go in linux/virt or linux/virt/fsl instead? why drivers/ ?

or maybe linux/virt should be drivers/virt ?

See discussion for v2 of this patch. I suggested that drivers/firmware and virt/ as options, the counterarguments were that drivers/firmware is for passive firmware as opposed to firmware that acts as a hypervisor, and that virt/ is for the host side of hypervisors like kvm, not for guests.

The driver in here most closely resembles the xen dom0 model, where a priviledged guest controls other guests, but unlike xen there is a single driver file, so there is no need to have drivers/fsl-hv directory just for this one file. We do have a number of other hypervisors that fit in the same category, so they can be added here later.

Arnd

#16 lore raw
In reply to Randy Dunlap
Quoted 9 lines · On Thursday 09 June 2011 01:10:09 Randy Dunlap wrote:
Quoted 3 lines · On Wed, 8 Jun 2011 17:45:54 -0500 Timur Tabi wrote:

Add the drivers/virt directory, which houses drivers that support virtualization environments, and add the Freescale hypervisor management driver.

It can't go in linux/virt or linux/virt/fsl instead? why drivers/ ?

or maybe linux/virt should be drivers/virt ?

See discussion for v2 of this patch. I suggested that drivers/firmware and virt/ as options, the counterarguments were that drivers/firmware is for passive firmware as opposed to firmware that acts as a hypervisor, and that virt/ is for the host side of hypervisors like kvm, not for guests.

The driver in here most closely resembles the xen dom0 model, where a priviledged guest controls other guests, but unlike xen there is a single driver file, so there is no need to have drivers/fsl-hv directory just for this one file. We do have a number of other hypervisors that fit in the same category, so they can be added here later.

Arnd

#4 lore raw
In reply to Arnd Bergmann
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · On Thursday 09 June 2011 01:10:09 Randy Dunlap wrote:
Quoted 3 lines · On Wed, 8 Jun 2011 17:45:54 -0500 Timur Tabi wrote:

Add the drivers/virt directory, which houses drivers that support virtualization environments, and add the Freescale hypervisor management driver.

Quoted 8 lines
Quoted 3 lines

It can't go in linux/virt or linux/virt/fsl instead? why drivers/ ?

or maybe linux/virt should be drivers/virt ?

See discussion for v2 of this patch. I suggested that drivers/firmware and virt/ as options, the counterarguments were that drivers/firmware is for passive firmware as opposed to firmware that acts as a hypervisor, and that virt/ is for the host side of hypervisors like kvm, not for guests.

OK, I read that thread. Didn't see a real consensus there.

If you were not the drivers/misc/ maintainer, would you mind if this driver lived in drivers/misc/? I wouldn't.

But it sounds like virt/ needs virt/host/ and virt/guest/ to me.

Quoted 5 lines

The driver in here most closely resembles the xen dom0 model, where a priviledged guest controls other guests, but unlike xen there is a single driver file, so there is no need to have drivers/fsl-hv directory just for this one file. We do have a number of other hypervisors that fit in the same category, so they can be added here later.

Signature · 2 lines
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
#11 lore raw
In reply to Arnd Bergmann
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · On Thursday 09 June 2011 01:10:09 Randy Dunlap wrote:
Quoted 3 lines · On Wed, 8 Jun 2011 17:45:54 -0500 Timur Tabi wrote:

Add the drivers/virt directory, which houses drivers that support virtualization environments, and add the Freescale hypervisor management driver.

Quoted 8 lines
Quoted 3 lines

It can't go in linux/virt or linux/virt/fsl instead? why drivers/ ?

or maybe linux/virt should be drivers/virt ?

See discussion for v2 of this patch. I suggested that drivers/firmware and virt/ as options, the counterarguments were that drivers/firmware is for passive firmware as opposed to firmware that acts as a hypervisor, and that virt/ is for the host side of hypervisors like kvm, not for guests.

OK, I read that thread. Didn't see a real consensus there.

If you were not the drivers/misc/ maintainer, would you mind if this driver lived in drivers/misc/? I wouldn't.

But it sounds like virt/ needs virt/host/ and virt/guest/ to me.

Quoted 5 lines

The driver in here most closely resembles the xen dom0 model, where a priviledged guest controls other guests, but unlike xen there is a single driver file, so there is no need to have drivers/fsl-hv directory just for this one file. We do have a number of other hypervisors that fit in the same category, so they can be added here later.

Signature · 2 lines
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
author
#5 lore raw
In reply to Randy Dunlap
Quoted 1 line · Randy Dunlap

But it sounds like virt/ needs virt/host/ and virt/guest/ to me.

I'm okay with that idea, except there's a consensus that drivers should be in drivers/.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
author
#10 lore raw
In reply to Randy Dunlap
Quoted 1 line · Randy Dunlap

But it sounds like virt/ needs virt/host/ and virt/guest/ to me.

I'm okay with that idea, except there's a consensus that drivers should be in drivers/.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#6 lore raw
In reply to Timur Tabi
Quoted 6 lines · Timur Tabi
Quoted 1 line · Randy Dunlap

But it sounds like virt/ needs virt/host/ and virt/guest/ to me.

I'm okay with that idea, except there's a consensus that drivers should be in drivers/.

Like sound/ ?

but what makes it a "driver"?

Signature · 2 lines
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
#9 lore raw
In reply to Timur Tabi
Quoted 6 lines · Timur Tabi
Quoted 1 line · Randy Dunlap

But it sounds like virt/ needs virt/host/ and virt/guest/ to me.

I'm okay with that idea, except there's a consensus that drivers should be in drivers/.

Like sound/ ?

but what makes it a "driver"?

Signature · 2 lines
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
author
#7 lore raw
In reply to Randy Dunlap
Quoted 4 lines · Randy Dunlap
Quoted 3 lines
Quoted 3 lines

I'm okay with that idea, except there's a consensus that drivers should be in drivers/.

Like sound/ ?

My understanding is that this is something that's considered broken and should be fixed, but I don't know what the holdup is.

Quoted 1 line

but what makes it a "driver"?

That's a good point.

Ok, so maybe I don't have any really good answers here. :-)

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
author
#8 lore raw
In reply to Randy Dunlap
Quoted 4 lines · Randy Dunlap
Quoted 3 lines
Quoted 3 lines

I'm okay with that idea, except there's a consensus that drivers should be in drivers/.

Like sound/ ?

My understanding is that this is something that's considered broken and should be fixed, but I don't know what the holdup is.

Quoted 1 line

but what makes it a "driver"?

That's a good point.

Ok, so maybe I don't have any really good answers here. :-)

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
author
#18 lore raw
In reply to Arnd Bergmann
Quoted 2 lines · Arnd Bergmann

Then get rid of all the code that takes apart the ioctl command numbers again and just do a switch/case based on the command.

I still need to keep that code to maintain binary compatibility with existing applications that pass the union as a parameter.

I'll fix that after we've updated the applications. But we have a chicken-or-the-egg problem where we need the same application to work with the new and old ioctl interface for a period of time.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#19 lore raw
Quoted 10 lines · On Thursday 09 June 2011 20:55:17 Timur Tabi wrote:
Quoted 2 lines · Arnd Bergmann

Then get rid of all the code that takes apart the ioctl command numbers again and just do a switch/case based on the command.

I still need to keep that code to maintain binary compatibility with existing applications that pass the union as a parameter.

I'll fix that after we've updated the applications. But we have a chicken-or-the-egg problem where we need the same application to work with the new and old ioctl interface for a period of time.

The lesson to learn here is obviously not to ship binaries of applications to customers before the driver has been merged in a mainline kernel.

The best way out that I can see is to make the driver carry the proper interface in the upstream version, but to have a private patch to support both interface versions in the kernel you ship on machines that require backwards compatibility. Once you have phased out the user application, you can then drop that patch and use the upstream version of the interfaces.

Arnd

author
#20 lore raw
Quoted 2 lines · Arnd Bergmann

The lesson to learn here is obviously not to ship binaries of applications to customers before the driver has been merged in a mainline kernel.

Believe me, I know this, but unfortunately I have no control over every aspect of our development cycle.

Quoted 6 lines

The best way out that I can see is to make the driver carry the proper interface in the upstream version, but to have a private patch to support both interface versions in the kernel you ship on machines that require backwards compatibility. Once you have phased out the user application, you can then drop that patch and use the upstream version of the interfaces.

I think I can make that work.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#12 lore raw
In reply to Arnd Bergmann
Quoted 14 lines · Arnd Bergmann
Quoted 8 lines · On Thursday 09 June 2011 01:10:09 Randy Dunlap wrote:
Quoted 3 lines · On Wed, 8 Jun 2011 17:45:54 -0500 Timur Tabi wrote:

Add the drivers/virt directory, which houses drivers that support virtualization environments, and add the Freescale hypervisor management driver.

It can't go in linux/virt or linux/virt/fsl instead? why drivers/ ?

or maybe linux/virt should be drivers/virt ?

See discussion for v2 of this patch. I suggested that drivers/firmware and virt/ as options, the counterarguments were that drivers/firmware is for passive firmware as opposed to firmware that acts as a hypervisor, and that virt/ is for the host side of hypervisors like kvm, not for guests.

Quoted 5 lines

The driver in here most closely resembles the xen dom0 model, where a priviledged guest controls other guests, but unlike xen there is a single driver file, so there is no need to have drivers/fsl-hv directory just for this one file. We do have a number of other hypervisors that fit in the same category, so they can be added here later.

This still leaves open the question of what really should go in this new directory. Is it just for drivers that manage/control the hypervisor? Or is it also for drivers that just use the hypervisor to do I/O of some kind, but aren't related to any other "family" of drivers, i.e., a driver that would have been dumped in drivers/char or drivers/misc in the old days?

My specific interest at the moment is the proposed tile-srom.c driver
(https://patchwork.kernel.org/patch/843892/), which uses a simple hypervisor read/write API to access the portion of the SPI ROM used to hold the boot stream for a TILE processor.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#15 lore raw
In reply to Arnd Bergmann
Quoted 14 lines · Arnd Bergmann
Quoted 8 lines · On Thursday 09 June 2011 01:10:09 Randy Dunlap wrote:
Quoted 3 lines · On Wed, 8 Jun 2011 17:45:54 -0500 Timur Tabi wrote:

Add the drivers/virt directory, which houses drivers that support virtualization environments, and add the Freescale hypervisor management driver.

It can't go in linux/virt or linux/virt/fsl instead? why drivers/ ?

or maybe linux/virt should be drivers/virt ?

See discussion for v2 of this patch. I suggested that drivers/firmware and virt/ as options, the counterarguments were that drivers/firmware is for passive firmware as opposed to firmware that acts as a hypervisor, and that virt/ is for the host side of hypervisors like kvm, not for guests.

Quoted 5 lines

The driver in here most closely resembles the xen dom0 model, where a priviledged guest controls other guests, but unlike xen there is a single driver file, so there is no need to have drivers/fsl-hv directory just for this one file. We do have a number of other hypervisors that fit in the same category, so they can be added here later.

This still leaves open the question of what really should go in this new directory. Is it just for drivers that manage/control the hypervisor? Or is it also for drivers that just use the hypervisor to do I/O of some kind, but aren't related to any other "family" of drivers, i.e., a driver that would have been dumped in drivers/char or drivers/misc in the old days?

My specific interest at the moment is the proposed tile-srom.c driver
(https://patchwork.kernel.org/patch/843892/), which uses a simple hypervisor read/write API to access the portion of the SPI ROM used to hold the boot stream for a TILE processor.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#13 lore raw
In reply to Chris Metcalf
Quoted 10 lines · Chris Metcalf

This still leaves open the question of what really should go in this new directory. Is it just for drivers that manage/control the hypervisor? Or is it also for drivers that just use the hypervisor to do I/O of some kind, but aren't related to any other "family" of drivers, i.e., a driver that would have been dumped in drivers/char or drivers/misc in the old days?

My specific interest at the moment is the proposed tile-srom.c driver
(https://patchwork.kernel.org/patch/843892/), which uses a simple hypervisor read/write API to access the portion of the SPI ROM used to hold the boot stream for a TILE processor.

I'd still put that driver in drivers/char for now, because it already contains similar drivers. We can probaby group them in a subdirectory of drivers/char at some point or move them out to a new directory.

For your raw hcall passthrough driver, that would be something that should go into drivers/virt/ IMHO.

Arnd

#14 lore raw
In reply to Chris Metcalf
Quoted 10 lines · Chris Metcalf

This still leaves open the question of what really should go in this new directory. Is it just for drivers that manage/control the hypervisor? Or is it also for drivers that just use the hypervisor to do I/O of some kind, but aren't related to any other "family" of drivers, i.e., a driver that would have been dumped in drivers/char or drivers/misc in the old days?

My specific interest at the moment is the proposed tile-srom.c driver
(https://patchwork.kernel.org/patch/843892/), which uses a simple hypervisor read/write API to access the portion of the SPI ROM used to hold the boot stream for a TILE processor.

I'd still put that driver in drivers/char for now, because it already contains similar drivers. We can probaby group them in a subdirectory of drivers/char at some point or move them out to a new directory.

For your raw hcall passthrough driver, that would be something that should go into drivers/virt/ IMHO.

Arnd