* Re: [openmcapi-dev] [PATCH v3 0/2] powerpc: define and implement MPIC message register support
From: Meador Inge @ 2011-06-09 14:44 UTC (permalink / raw)
To: Scott Wood, galak
Cc: openmcapi-dev, devicetree-discuss, Blanchard, Hollis,
linuxppc-dev
In-Reply-To: <1306869543-18812-1-git-send-email-meador_inge@mentor.com>
On 05/31/2011 02:19 PM, Meador Inge wrote:
> This patch set defines a binding for FSL MPIC message registers and implements
> an API for accessing those message registers. Testing was done on a MPC8572DS
> in an Linux-Linux AMP setup using OpenMCAPI (www.openmcapi.org) to communicate
> between OS instances. The message register API is used by the OpenMCAPI shared
> memory driver to send notifications between cores.
>
> * v3 - Clarified a point in the binding concerning the length of the
> 'interrupts' property. Pointed out by Scott Wood.
>
> * v2 - Incorporate feedback from Scott Wood
> * Make binding less implementation specific.
> * Add 'mpic-' prefix to message register node properties and aliases.
> * Remove 'interrupt-parent' from binding.
> * Fixed some example bugs with receive masks.
>
> Signed-off-by: Meador Inge <meador_inge@mentor.com>
> Cc: Hollis Blanchard <hollis_blanchard@mentor.com>
>
> Meador Inge (2):
> powerpc: document the FSL MPIC message register binding
The binding has been acked (Thanks Scott).
> powerpc: add support for MPIC message register API
Scott, Kumar, are you all OK with the
implementation: http://patchwork.ozlabs.org/patch/98075/ ?
--
Meador Inge
CodeSourcery / Mentor Embedded
http://www.mentor.com/embedded-software
^ permalink raw reply
* Re: [PATCH 7/7] [v4] drivers/virt: introduce Freescale hypervisor management driver
From: Arnd Bergmann @ 2011-06-09 7:38 UTC (permalink / raw)
To: linuxppc-dev, Linux Virtualization
Cc: Randy Dunlap, konrad.wilk, greg, kumar.gala, linux-kernel,
cmetcalf, akpm, dsaxena, linux-console, Timur Tabi, alan
In-Reply-To: <20110608161009.7b05d305.randy.dunlap@oracle.com>
On Thursday 09 June 2011 01:10:09 Randy Dunlap wrote:
> 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
^ permalink raw reply
* Re: [PATCH 7/7] [v4] drivers/virt: introduce Freescale hypervisor management driver
From: Arnd Bergmann @ 2011-06-09 7:29 UTC (permalink / raw)
To: linuxppc-dev
Cc: konrad.wilk, kumar.gala, linux-kernel, cmetcalf, akpm, dsaxena,
linux-console, greg, Timur Tabi, alan
In-Reply-To: <1307573154-15838-1-git-send-email-timur@freescale.com>
On Thursday 09 June 2011 00:45:54 Timur Tabi wrote:
> +struct fsl_hv_ioctl_memcpy {
> + __u32 ret;
> + __u32 source;
> + __u32 target;
> + __u64 local_vaddr;
> + __u64 remote_paddr;
> + __u64 count;
> +};
> +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.
> +/*
> + * 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 */
> + 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
^ permalink raw reply
* Re: [PATCH] gianfar:localized filer table
From: David Miller @ 2011-06-09 7:13 UTC (permalink / raw)
To: b06378; +Cc: netdev, linuxppc-dev
In-Reply-To: <1307519211-3540-1-git-send-email-b06378@freescale.com>
From: Jiajun Wu <b06378@freescale.com>
Date: Wed, 8 Jun 2011 15:46:51 +0800
> Each eTSEC device should own localized filer table.
>
> Signed-off-by: Jiajun Wu <b06378@freescale.com>
Applied, thanks.
^ permalink raw reply
* Re: [patch 13/14] PCSPKR: Cleanup Kconfig dependencies
From: Benjamin Herrenschmidt @ 2011-06-09 5:09 UTC (permalink / raw)
To: ralf
Cc: linux-arch, linux-mips, linux-alpha, x86, linux-kernel,
Ingo Molnar, Paul Mackerras, H. Peter Anvin, Ivan Kokshaysky,
Matt Turner, linuxppc-dev, Thomas Gleixner, Richard Henderson
In-Reply-To: <20110601180610.984881988@duck.linux-mips.net>
On Wed, 2011-06-01 at 19:05 +0100, ralf@linux-mips.org wrote:
> plain text document attachment
> (i8253-use-aux-symbol-for-pcspkr-config.patch)
> Lenghty lists of the kind "depends on ARCH1 || ARCH2 ... || ARCH123" are
> usually either wrong or too coarse grained. Or plain an ugly sin.
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
> To: linux-kernel@vger.kernel.org
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> Cc: Matt Turner <mattst88@gmail.com>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> Cc: linux-alpha@vger.kernel.org
> Cc: linux-mips@linux-mips.org
> Cc: linuxppc-dev@lists.ozlabs.org
^ permalink raw reply
* Re: [PATCH] Fix build warning of the defconfigs
From: Benjamin Herrenschmidt @ 2011-06-09 5:06 UTC (permalink / raw)
To: Wanlong Gao
Cc: linux-mips, david.woodhouse, linux-sh, paulus, gxt, sam, linux,
manuel.lauss, rientjes, mingo, vapier, arnd, u.kleine-koenig,
anton, linux-arm-kernel, linux-kernel, ralf, lethal,
uclinux-dist-devel, akpm, linuxppc-dev, hans-christian.egtvedt
In-Reply-To: <1306945763-6583-1-git-send-email-wanlong.gao@gmail.com>
On Thu, 2011-06-02 at 00:29 +0800, Wanlong Gao wrote:
> RTC_CLASS is changed to bool.
> So value 'm' is invalid.
>
> Signed-off-by: Wanlong Gao <wanlong.gao@gmail.com>
> ---
For powerpc:
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Thanks !
Ben.
^ permalink raw reply
* Re: [patch 09/14] i8253: Alpha, PowerPC: Remove unused <asm/8253pit.h> header.
From: Benjamin Herrenschmidt @ 2011-06-09 5:07 UTC (permalink / raw)
To: ralf
Cc: linux-arch, linux-kernel, Ivan Kokshaysky, linux-alpha,
Paul Mackerras, Matt Turner, linuxppc-dev, Richard Henderson
In-Reply-To: <20110601180610.684557757@duck.linux-mips.net>
On Wed, 2011-06-01 at 19:05 +0100, ralf@linux-mips.org wrote:
> plain text document attachment
> (i8253-remove-unused-8253pit.h-files.patch)
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
> To: linux-kernel@vger.kernel.org
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> Cc: Matt Turner <mattst88@gmail.com>
> Cc: linux-alpha@vger.kernel.org
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: linuxppc-dev@lists.ozlabs.org
>
> arch/alpha/include/asm/8253pit.h | 3 ---
> arch/powerpc/include/asm/8253pit.h | 3 ---
> 2 files changed, 6 deletions(-)
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Thanks !
Ben.
> Index: linux-mips/arch/alpha/include/asm/8253pit.h
> ===================================================================
> --- linux-mips.orig/arch/alpha/include/asm/8253pit.h
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -/*
> - * 8253/8254 Programmable Interval Timer
> - */
> Index: linux-mips/arch/powerpc/include/asm/8253pit.h
> ===================================================================
> --- linux-mips.orig/arch/powerpc/include/asm/8253pit.h
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -/*
> - * 8253/8254 Programmable Interval Timer
> - */
>
^ permalink raw reply
* [GIT PULL] trivial fix for .gitignore files in powerpc
From: Grant Likely @ 2011-06-09 0:52 UTC (permalink / raw)
To: Benjamin Herrenschmidt, linuxppc-dev
The following changes since commit 06e86849cf4019945a106913adb9ff0abcc01770:
Merge branch 'pm-fixes' of
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6
(2011-06-08 15:58:51 -0700)
are available in the git repository at:
git://git.secretlab.ca/git/linux-2.6 powerpc/merge
Wolfram Sang (1):
dtc/powerpc: remove obsolete .gitignore entries
arch/powerpc/boot/.gitignore | 1 -
arch/powerpc/boot/dtc-src/.gitignore | 3 ---
2 files changed, 0 insertions(+), 4 deletions(-)
delete mode 100644 arch/powerpc/boot/dtc-src/.gitignore
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply
* Re: [PATCH 7/7] [v4] drivers/virt: introduce Freescale hypervisor management driver
From: Randy Dunlap @ 2011-06-08 23:10 UTC (permalink / raw)
To: Timur Tabi
Cc: arnd, konrad.wilk, kumar.gala, linux-kernel, cmetcalf, akpm,
dsaxena, linux-console, greg, linuxppc-dev, alan
In-Reply-To: <1307573154-15838-1-git-send-email-timur@freescale.com>
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 ?
> 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.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
> 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
> diff --git a/include/linux/fsl_hypervisor.h b/include/linux/fsl_hypervisor.h
> new file mode 100644
> index 0000000..4d1e11a
> --- /dev/null
> +++ b/include/linux/fsl_hypervisor.h
> @@ -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
> + * 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.
> + *
> + * 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
> + * 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
> + * @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 */
> + 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.
> + *
> + * 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.
> + */
> +int fsl_hv_failover_unregister(struct notifier_block *nb);
> +
> +#endif
> +
> +#endif
> --
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
^ permalink raw reply
* Re: [PATCH 7/7] [v4] drivers/virt: introduce Freescale hypervisor management driver
From: Timur Tabi @ 2011-06-08 23:16 UTC (permalink / raw)
To: Randy Dunlap
Cc: arnd, konrad.wilk, kumar.gala, linux-kernel, cmetcalf, akpm,
dsaxena, linux-console, greg, linuxppc-dev, alan
In-Reply-To: <20110608161009.7b05d305.randy.dunlap@oracle.com>
Randy Dunlap 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 ?
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.
>> > + * 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.
>> > +/**
>> > + * 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
>
Ok, I'll change it.
>> > + * 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.
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply
* [PATCH 7/7] [v4] drivers/virt: introduce Freescale hypervisor management driver
From: Timur Tabi @ 2011-06-08 22:45 UTC (permalink / raw)
To: alan, arnd, kumar.gala, benh, greg, akpm, cmetcalf, konrad.wilk,
dsaxena, linuxppc-dev, linux-kernel, linux-console
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.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
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
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 557a469..0371680 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -122,4 +122,6 @@ source "drivers/hwspinlock/Kconfig"
source "drivers/clocksource/Kconfig"
+source "drivers/virt/Kconfig"
+
endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index 3f135b6..306c80e5 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -119,3 +119,6 @@ obj-y += ieee802154/
obj-y += clk/
obj-$(CONFIG_HWSPINLOCK) += hwspinlock/
+
+# Virtualization drivers
+obj-$(VIRT_DRIVERS) += virt/
diff --git a/drivers/virt/Kconfig b/drivers/virt/Kconfig
new file mode 100644
index 0000000..b0cb0b6
--- /dev/null
+++ b/drivers/virt/Kconfig
@@ -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
diff --git a/drivers/virt/Makefile b/drivers/virt/Makefile
new file mode 100644
index 0000000..c47f04d
--- /dev/null
+++ b/drivers/virt/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for drivers that support virtualization
+#
+
+obj-$(CONFIG_FSL_HV_MANAGER) += fsl_hypervisor.o
diff --git a/drivers/virt/fsl_hypervisor.c b/drivers/virt/fsl_hypervisor.c
new file mode 100644
index 0000000..2b41d48
--- /dev/null
+++ b/drivers/virt/fsl_hypervisor.c
@@ -0,0 +1,961 @@
+/*
+ * Freescale Hypervisor Management Driver
+
+ * Copyright (C) 2008-2011 Freescale Semiconductor, Inc.
+ * Author: Timur Tabi <timur@freescale.com>
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ *
+ * This driver contains functions to support the Freescale hypervisor.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/err.h>
+#include <linux/fs.h>
+#include <linux/miscdevice.h>
+#include <linux/mm.h>
+#include <linux/pagemap.h>
+#include <linux/slab.h>
+#include <linux/poll.h>
+#include <linux/of.h>
+#include <linux/reboot.h>
+#include <linux/uaccess.h>
+#include <linux/notifier.h>
+
+#include <linux/io.h>
+#include <asm/fsl_hcalls.h>
+
+#include <linux/fsl_hypervisor.h>
+
+static BLOCKING_NOTIFIER_HEAD(failover_subscribers);
+
+/*
+ * Ioctl interface for FSL_HV_IOCTL_PARTITION_RESTART
+ *
+ * Restart a running partition
+ */
+static long ioctl_restart(struct fsl_hv_ioctl_restart __user *p)
+{
+ struct fsl_hv_ioctl_restart param;
+
+ /* Get the parameters from the user */
+ if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_restart)))
+ return -EFAULT;
+
+ param.ret = fh_partition_restart(param.partition);
+
+ if (copy_to_user(&p->ret, ¶m.ret, sizeof(__u32)))
+ return -EFAULT;
+
+ return 0;
+}
+
+/*
+ * Ioctl interface for FSL_HV_IOCTL_PARTITION_STATUS
+ *
+ * Query the status of a partition
+ */
+static long ioctl_status(struct fsl_hv_ioctl_status __user *p)
+{
+ struct fsl_hv_ioctl_status param;
+ u32 status;
+
+ /* Get the parameters from the user */
+ if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_status)))
+ return -EFAULT;
+
+ param.ret = fh_partition_get_status(param.partition, &status);
+ if (!param.ret)
+ param.status = status;
+
+ if (copy_to_user(p, ¶m, sizeof(struct fsl_hv_ioctl_status)))
+ return -EFAULT;
+
+ return 0;
+}
+
+/*
+ * Ioctl interface for FSL_HV_IOCTL_PARTITION_START
+ *
+ * Start a stopped partition.
+ */
+static long ioctl_start(struct fsl_hv_ioctl_start __user *p)
+{
+ struct fsl_hv_ioctl_start param;
+
+ /* Get the parameters from the user */
+ if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_start)))
+ return -EFAULT;
+
+ param.ret = fh_partition_start(param.partition, param.entry_point,
+ param.load);
+
+ if (copy_to_user(&p->ret, ¶m.ret, sizeof(__u32)))
+ return -EFAULT;
+
+ return 0;
+}
+
+/*
+ * Ioctl interface for FSL_HV_IOCTL_PARTITION_STOP
+ *
+ * Stop a running partition
+ */
+static long ioctl_stop(struct fsl_hv_ioctl_stop __user *p)
+{
+ struct fsl_hv_ioctl_stop param;
+
+ /* Get the parameters from the user */
+ if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_stop)))
+ return -EFAULT;
+
+ param.ret = fh_partition_stop(param.partition);
+
+ if (copy_to_user(&p->ret, ¶m.ret, sizeof(__u32)))
+ return -EFAULT;
+
+ return 0;
+}
+
+/*
+ * Ioctl interface for FSL_HV_IOCTL_MEMCPY
+ *
+ * The FH_MEMCPY hypercall takes an array of address/address/size structures
+ * to represent the data being copied. As a convenience to the user, this
+ * ioctl takes a user-create buffer and a pointer to a guest physically
+ * contiguous buffer in the remote partition, and creates the
+ * address/address/size array for the hypercall.
+ */
+static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p)
+{
+ struct fsl_hv_ioctl_memcpy param;
+
+ struct page **pages = NULL;
+ void *sg_list_unaligned = NULL;
+ struct fh_sg_list *sg_list = NULL;
+
+ unsigned int num_pages;
+ unsigned long lb_offset; /* Offset within a page of the local buffer */
+
+ unsigned int i;
+ long ret = 0;
+ int num_pinned; /* return value from get_user_pages() */
+ phys_addr_t remote_paddr; /* The next address in the remote buffer */
+ uint32_t count; /* The number of bytes left to copy */
+
+ /* Get the parameters from the user */
+ if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_memcpy)))
+ return -EFAULT;
+
+ /* One partition must be local, the other must be remote. In other
+ words, if source and target are both -1, or are both not -1, then
+ return an error. */
+ if ((param.source == -1) == (param.target == -1))
+ return -EINVAL;
+
+ /*
+ * The array of pages returned by get_user_pages() covers only
+ * page-aligned memory. Since the user buffer is probably not
+ * page-aligned, we need to handle the discrepancy.
+ *
+ * We calculate the offset within a page of the S/G list, and make
+ * adjustments accordingly. This will result in a page list that looks
+ * like this:
+ *
+ * ---- <-- first page starts before the buffer
+ * | |
+ * |////|-> ----
+ * |////| | |
+ * ---- | |
+ * | |
+ * ---- | |
+ * |////| | |
+ * |////| | |
+ * |////| | |
+ * ---- | |
+ * | |
+ * ---- | |
+ * |////| | |
+ * |////| | |
+ * |////| | |
+ * ---- | |
+ * | |
+ * ---- | |
+ * |////| | |
+ * |////|-> ----
+ * | | <-- last page ends after the buffer
+ * ----
+ *
+ * The distance between the start of the first page and the start of the
+ * buffer is lb_offset. The hashed (///) areas are the parts of the
+ * page list that contain the actual buffer.
+ *
+ * The advantage of this approach is that the number of pages is
+ * equal to the number of entries in the S/G list that we give to the
+ * hypervisor.
+ */
+ lb_offset = param.local_vaddr & (PAGE_SIZE - 1);
+ num_pages = (param.count + lb_offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
+
+ /* Allocate the buffers we need */
+
+ /* pages is an array of struct page pointers that's initialized by
+ get_user_pages() */
+ pages = kzalloc(num_pages * sizeof(struct page *), GFP_KERNEL);
+ if (!pages) {
+ pr_debug("fsl-hv: could not allocate page list\n");
+ return -ENOMEM;
+ }
+
+ /* sg_list is the list of fh_sg_list objects that we pass to the
+ hypervisor */
+ sg_list_unaligned = kmalloc(num_pages * sizeof(struct fh_sg_list) +
+ sizeof(struct fh_sg_list) - 1, GFP_KERNEL);
+ if (!sg_list_unaligned) {
+ pr_debug("fsl-hv: could not allocate S/G list\n");
+ ret = -ENOMEM;
+ goto exit;
+ }
+ sg_list = PTR_ALIGN(sg_list_unaligned, sizeof(struct fh_sg_list));
+
+ /* Get the physical addresses of the source buffer */
+ down_read(¤t->mm->mmap_sem);
+ num_pinned = get_user_pages(current, current->mm,
+ param.local_vaddr - lb_offset, num_pages,
+ (param.source == -1) ? READ : WRITE,
+ 0, pages, NULL);
+ up_read(¤t->mm->mmap_sem);
+
+ if (num_pinned != num_pages) {
+ /* get_user_pages() failed */
+ pr_debug("fsl-hv: could not lock source buffer\n");
+ ret = (num_pinned < 0) ? num_pinned : -EFAULT;
+ goto exit;
+ }
+
+ /*
+ * Build the fh_sg_list[] array. The first page is special
+ * because it's misaligned.
+ */
+ if (param.source == -1) {
+ sg_list[0].source = page_to_phys(pages[0]) + lb_offset;
+ sg_list[0].target = param.remote_paddr;
+ } else {
+ sg_list[0].source = param.remote_paddr;
+ sg_list[0].target = page_to_phys(pages[0]) + lb_offset;
+ }
+ sg_list[0].size = min_t(uint64_t, param.count, PAGE_SIZE - lb_offset);
+
+ remote_paddr = param.remote_paddr + sg_list[0].size;
+ count = param.count - sg_list[0].size;
+
+ for (i = 1; i < num_pages; i++) {
+ if (param.source == -1) {
+ /* local to remote */
+ sg_list[i].source = page_to_phys(pages[i]);
+ sg_list[i].target = remote_paddr;
+ } else {
+ /* remote to local */
+ sg_list[i].source = remote_paddr;
+ sg_list[i].target = page_to_phys(pages[i]);
+ }
+ sg_list[i].size = min_t(uint64_t, count, PAGE_SIZE);
+
+ remote_paddr += sg_list[i].size;
+ count -= sg_list[i].size;
+ }
+
+ param.ret = fh_partition_memcpy(param.source, param.target,
+ virt_to_phys(sg_list), num_pages);
+
+exit:
+ if (pages) {
+ for (i = 0; i < num_pages; i++)
+ if (pages[i])
+ put_page(pages[i]);
+ }
+
+ kfree(sg_list_unaligned);
+ kfree(pages);
+
+ if (!ret)
+ if (copy_to_user(&p->ret, ¶m.ret, sizeof(__u32)))
+ return -EFAULT;
+
+ return ret;
+}
+
+/*
+ * Ioctl interface for FSL_HV_IOCTL_DOORBELL
+ *
+ * Ring a doorbell
+ */
+static long ioctl_doorbell(struct fsl_hv_ioctl_doorbell __user *p)
+{
+ struct fsl_hv_ioctl_doorbell param;
+
+ /* Get the parameters from the user */
+ if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_doorbell)))
+ return -EFAULT;
+
+ param.ret = ev_doorbell_send(param.doorbell);
+
+ if (copy_to_user(&p->ret, ¶m.ret, sizeof(__u32)))
+ return -EFAULT;
+
+ return 0;
+}
+
+static long ioctl_dtprop(struct fsl_hv_ioctl_prop __user *p, int set)
+{
+ struct fsl_hv_ioctl_prop param;
+ char __user *upath, *upropname;
+ void __user *upropval;
+ char *path = NULL, *propname = NULL;
+ void *propval = NULL;
+ int ret = 0;
+
+ /* Get the parameters from the user */
+ if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_prop)))
+ return -EFAULT;
+
+ upath = (char __user *)(uintptr_t)param.path;
+ upropname = (char __user *)(uintptr_t)param.propname;
+ upropval = (void __user *)(uintptr_t)param.propval;
+
+ path = strndup_user(upath, FH_DTPROP_MAX_PATHLEN);
+ if (IS_ERR(path)) {
+ ret = PTR_ERR(path);
+ goto out;
+ }
+
+ propname = strndup_user(upropname, FH_DTPROP_MAX_PATHLEN);
+ if (IS_ERR(propname)) {
+ ret = PTR_ERR(propname);
+ goto out;
+ }
+
+ if (param.proplen > FH_DTPROP_MAX_PROPLEN) {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ propval = kmalloc(param.proplen, GFP_KERNEL);
+ if (!propval) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ if (set) {
+ if (copy_from_user(propval, upropval, param.proplen)) {
+ ret = -EFAULT;
+ goto out;
+ }
+
+ param.ret = fh_partition_set_dtprop(param.handle,
+ virt_to_phys(path),
+ virt_to_phys(propname),
+ virt_to_phys(propval),
+ param.proplen);
+ } else {
+ param.ret = fh_partition_get_dtprop(param.handle,
+ virt_to_phys(path),
+ virt_to_phys(propname),
+ virt_to_phys(propval),
+ ¶m.proplen);
+
+ if (param.ret == 0) {
+ if (copy_to_user(upropval, propval, param.proplen) ||
+ put_user(param.proplen, &p->proplen)) {
+ ret = -EFAULT;
+ goto out;
+ }
+ }
+ }
+
+ if (put_user(param.ret, &p->ret))
+ ret = -EFAULT;
+
+out:
+ kfree(path);
+ kfree(propval);
+ kfree(propname);
+
+ return ret;
+}
+
+/*
+ * Ioctl main entry point
+ */
+static long fsl_hv_ioctl(struct file *file, unsigned int cmd,
+ unsigned long argaddr)
+{
+ void __user *arg = (void __user *)argaddr;
+ long ret;
+ size_t size;
+
+ /* Make sure the application is called the right driver. */
+ if (_IOC_TYPE(cmd) != 0) {
+ pr_debug("fsl-hv: ioctl type %u should be 0\n", _IOC_TYPE(cmd));
+ return -EINVAL;
+ }
+
+ /* Make sure the application set the direction flag correctly. */
+ if (_IOC_DIR(cmd) != (_IOC_READ | _IOC_WRITE)) {
+ pr_debug("fsl-hv: ioctl direction should be _IOWR\n");
+ return -EINVAL;
+ }
+
+ /*
+ * Make sure the application is passing the right structure to us.
+ * For backwards compatibility with older applications, we only check
+ * if the size is too small, rather than unequal.
+ */
+
+ switch (_IOC_NR(cmd)) {
+ case FSL_HV_IOCTL_PARTITION_RESTART:
+ size = sizeof(struct fsl_hv_ioctl_restart);
+ if (_IOC_SIZE(cmd) < size)
+ goto size_error;
+ ret = ioctl_restart(arg);
+ break;
+ case FSL_HV_IOCTL_PARTITION_GET_STATUS:
+ size = sizeof(struct fsl_hv_ioctl_status);
+ if (_IOC_SIZE(cmd) < size)
+ goto size_error;
+ ret = ioctl_status(arg);
+ break;
+ case FSL_HV_IOCTL_PARTITION_START:
+ size = sizeof(struct fsl_hv_ioctl_start);
+ if (_IOC_SIZE(cmd) < size)
+ goto size_error;
+ ret = ioctl_start(arg);
+ break;
+ case FSL_HV_IOCTL_PARTITION_STOP:
+ size = sizeof(struct fsl_hv_ioctl_stop);
+ if (_IOC_SIZE(cmd) < size)
+ goto size_error;
+ ret = ioctl_stop(arg);
+ break;
+ case FSL_HV_IOCTL_MEMCPY:
+ size = sizeof(struct fsl_hv_ioctl_memcpy);
+ if (_IOC_SIZE(cmd) < size)
+ goto size_error;
+ ret = ioctl_memcpy(arg);
+ break;
+ case FSL_HV_IOCTL_DOORBELL:
+ size = sizeof(struct fsl_hv_ioctl_doorbell);
+ if (_IOC_SIZE(cmd) < size)
+ goto size_error;
+ ret = ioctl_doorbell(arg);
+ break;
+ case FSL_HV_IOCTL_GETPROP:
+ size = sizeof(struct fsl_hv_ioctl_prop);
+ if (_IOC_SIZE(cmd) < size)
+ goto size_error;
+ ret = ioctl_dtprop(arg, 0);
+ break;
+ case FSL_HV_IOCTL_SETPROP:
+ size = sizeof(struct fsl_hv_ioctl_prop);
+ if (_IOC_SIZE(cmd) < size)
+ goto size_error;
+ ret = ioctl_dtprop(arg, 1);
+ break;
+ default:
+ pr_debug("fsl-hv: unknown ioctl %u\n", _IOC_NR(cmd));
+ return -ENOTTY;
+ }
+
+ return ret;
+
+size_error:
+ pr_debug("fsl-hv: ioctl %u parameter size %u should be %zu\n",
+ _IOC_NR(cmd), _IOC_SIZE(cmd), size);
+ return -EINVAL;
+}
+
+/* Linked list of processes that have us open */
+static struct list_head db_list;
+
+/* spinlock for db_list */
+static DEFINE_SPINLOCK(db_list_lock);
+
+/* The size of the doorbell event queue. This must be a power of two. */
+#define QSIZE 16
+
+/* Returns the next head/tail pointer, wrapping around the queue if necessary */
+#define nextp(x) (((x) + 1) & (QSIZE - 1))
+
+/* Per-open data structure */
+struct doorbell_queue {
+ struct list_head list;
+ spinlock_t lock;
+ wait_queue_head_t wait;
+ unsigned int head;
+ unsigned int tail;
+ uint32_t q[QSIZE];
+};
+
+/* Linked list of ISRs that we registered */
+struct list_head isr_list;
+
+/* Per-ISR data structure */
+struct doorbell_isr {
+ struct list_head list;
+ unsigned int irq;
+ uint32_t doorbell; /* The doorbell handle */
+ uint32_t partition; /* The partition handle, if used */
+};
+
+/*
+ * Add a doorbell to all of the doorbell queues
+ */
+static void fsl_hv_queue_doorbell(uint32_t doorbell)
+{
+ struct doorbell_queue *dbq;
+ unsigned long flags;
+
+ /* Prevent another core from modifying db_list */
+ spin_lock_irqsave(&db_list_lock, flags);
+
+ list_for_each_entry(dbq, &db_list, list) {
+ if (dbq->head != nextp(dbq->tail)) {
+ dbq->q[dbq->tail] = doorbell;
+ /* This memory barrier eliminates the need to grab
+ * the spinlock for dbq. */
+ smp_wmb();
+ dbq->tail = nextp(dbq->tail);
+ wake_up_interruptible(&dbq->wait);
+ }
+ }
+
+ spin_unlock_irqrestore(&db_list_lock, flags);
+}
+
+/*
+ * Interrupt handler for all doorbells
+ *
+ * We use the same interrupt handler for all doorbells. Whenever a doorbell
+ * is rung, and we receive an interrupt, we just put the handle for that
+ * doorbell (passed to us as *data) into all of the queues.
+ */
+static irqreturn_t fsl_hv_isr(int irq, void *data)
+{
+ fsl_hv_queue_doorbell((uintptr_t) data);
+
+ return IRQ_HANDLED;
+}
+
+/*
+ * State change thread function
+ *
+ * The state change notification arrives in an interrupt, but we can't call
+ * blocking_notifier_call_chain() in an interrupt handler. We could call
+ * atomic_notifier_call_chain(), but that would require the clients' call-back
+ * function to run in interrupt context. Since we don't want to impose that
+ * restriction on the clients, we use a threaded IRQ to process the
+ * notification in kernel context.
+ */
+static irqreturn_t fsl_hv_state_change_thread(int irq, void *data)
+{
+ struct doorbell_isr *dbisr = data;
+
+ blocking_notifier_call_chain(&failover_subscribers, dbisr->partition,
+ NULL);
+
+ return IRQ_HANDLED;
+}
+
+/*
+ * Interrupt handler for state-change doorbells
+ */
+static irqreturn_t fsl_hv_state_change_isr(int irq, void *data)
+{
+ unsigned int status;
+ struct doorbell_isr *dbisr = data;
+ int ret;
+
+ /* It's still a doorbell, so add it to all the queues */
+ fsl_hv_queue_doorbell(dbisr->doorbell);
+
+ /* Determine the new state, and if it's stopped, notify the clients. */
+ ret = fh_partition_get_status(dbisr->partition, &status);
+ if (!ret && (status == FH_PARTITION_STOPPED))
+ return IRQ_WAKE_THREAD;
+
+ return IRQ_HANDLED;
+}
+
+/*
+ * Returns a bitmask indicating whether a read will block
+ */
+static unsigned int fsl_hv_poll(struct file *filp, struct poll_table_struct *p)
+{
+ struct doorbell_queue *dbq = filp->private_data;
+ unsigned long flags;
+ unsigned int mask;
+
+ spin_lock_irqsave(&dbq->lock, flags);
+
+ poll_wait(filp, &dbq->wait, p);
+ mask = (dbq->head == dbq->tail) ? 0 : (POLLIN | POLLRDNORM);
+
+ spin_unlock_irqrestore(&dbq->lock, flags);
+
+ return mask;
+}
+
+/*
+ * Return the handles for any incoming doorbells
+ *
+ * If there are doorbell handles in the queue for this open instance, then
+ * return them to the caller as an array of 32-bit integers. Otherwise,
+ * block until there is at least one handle to return.
+ */
+static ssize_t fsl_hv_read(struct file *filp, char __user *buf, size_t len,
+ loff_t *off)
+{
+ struct doorbell_queue *dbq = filp->private_data;
+ uint32_t __user *p = (uint32_t __user *) buf; /* for put_user() */
+ unsigned long flags;
+ ssize_t count = 0;
+
+ /* Make sure we stop when the user buffer is full. */
+ while (len >= sizeof(uint32_t)) {
+ uint32_t dbell; /* Local copy of doorbell queue data */
+
+ spin_lock_irqsave(&dbq->lock, flags);
+
+ /* If the queue is empty, then either we're done or we need
+ * to block. If the application specified O_NONBLOCK, then
+ * we return the appropriate error code.
+ */
+ if (dbq->head == dbq->tail) {
+ spin_unlock_irqrestore(&dbq->lock, flags);
+ if (count)
+ break;
+ if (filp->f_flags & O_NONBLOCK)
+ return -EAGAIN;
+ if (wait_event_interruptible(dbq->wait,
+ dbq->head != dbq->tail))
+ return -ERESTARTSYS;
+ continue;
+ }
+
+ /* Even though we have an smp_wmb() in the ISR, the core
+ * might speculatively execute the "dbell = ..." below while
+ * it's evaluating the if-statement above. In that case, the
+ * value put into dbell could be stale if the core accepts the
+ * speculation. To prevent that, we need a read memory barrier
+ * here as well.
+ */
+ smp_rmb();
+
+ /* Copy the data to a temporary local buffer, because
+ * we can't call copy_to_user() from inside a spinlock
+ */
+ dbell = dbq->q[dbq->head];
+ dbq->head = nextp(dbq->head);
+
+ spin_unlock_irqrestore(&dbq->lock, flags);
+
+ if (put_user(dbell, p))
+ return -EFAULT;
+ p++;
+ count += sizeof(uint32_t);
+ len -= sizeof(uint32_t);
+ }
+
+ return count;
+}
+
+/*
+ * Open the driver and prepare for reading doorbells.
+ *
+ * Every time an application opens the driver, we create a doorbell queue
+ * for that file handle. This queue is used for any incoming doorbells.
+ */
+static int fsl_hv_open(struct inode *inode, struct file *filp)
+{
+ struct doorbell_queue *dbq;
+ unsigned long flags;
+ int ret = 0;
+
+ dbq = kzalloc(sizeof(struct doorbell_queue), GFP_KERNEL);
+ if (!dbq) {
+ pr_err("fsl-hv: out of memory\n");
+ return -ENOMEM;
+ }
+
+ spin_lock_init(&dbq->lock);
+ init_waitqueue_head(&dbq->wait);
+
+ spin_lock_irqsave(&db_list_lock, flags);
+ list_add(&dbq->list, &db_list);
+ spin_unlock_irqrestore(&db_list_lock, flags);
+
+ filp->private_data = dbq;
+
+ return ret;
+}
+
+/*
+ * Close the driver
+ */
+static int fsl_hv_close(struct inode *inode, struct file *filp)
+{
+ struct doorbell_queue *dbq = filp->private_data;
+ unsigned long flags;
+
+ int ret = 0;
+
+ spin_lock_irqsave(&db_list_lock, flags);
+ list_del(&dbq->list);
+ spin_unlock_irqrestore(&db_list_lock, flags);
+
+ kfree(dbq);
+
+ return ret;
+}
+
+static const struct file_operations fsl_hv_fops = {
+ .owner = THIS_MODULE,
+ .open = fsl_hv_open,
+ .release = fsl_hv_close,
+ .poll = fsl_hv_poll,
+ .read = fsl_hv_read,
+ .unlocked_ioctl = fsl_hv_ioctl,
+};
+
+static struct miscdevice fsl_hv_misc_dev = {
+ MISC_DYNAMIC_MINOR,
+ "fsl-hv",
+ &fsl_hv_fops
+};
+
+static irqreturn_t fsl_hv_shutdown_isr(int irq, void *data)
+{
+ orderly_poweroff(false);
+
+ return IRQ_HANDLED;
+}
+
+/*
+ * Returns the handle of the parent of the given node
+ *
+ * The handle is the value of the 'hv-handle' property
+ */
+static int get_parent_handle(struct device_node *np)
+{
+ struct device_node *parent;
+ const uint32_t *prop;
+ uint32_t handle;
+ int len;
+
+ parent = of_get_parent(np);
+ if (!parent)
+ /* It's not really possible for this to fail */
+ return -ENODEV;
+
+ /*
+ * The proper name for the handle property is "hv-handle", but some
+ * older versions of the hypervisor used "reg".
+ */
+ prop = of_get_property(parent, "hv-handle", &len);
+ if (!prop)
+ prop = of_get_property(parent, "reg", &len);
+
+ if (!prop || (len != sizeof(uint32_t))) {
+ /* This can happen only if the node is malformed */
+ of_node_put(parent);
+ return -ENODEV;
+ }
+
+ handle = be32_to_cpup(prop);
+ of_node_put(parent);
+
+ return handle;
+}
+
+/*
+ * Register a callback for failover events
+ *
+ * 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)
+{
+ return blocking_notifier_chain_register(&failover_subscribers, nb);
+}
+EXPORT_SYMBOL(fsl_hv_failover_register);
+
+/*
+ * Unregister a callback for failover events
+ */
+int fsl_hv_failover_unregister(struct notifier_block *nb)
+{
+ return blocking_notifier_chain_unregister(&failover_subscribers, nb);
+}
+EXPORT_SYMBOL(fsl_hv_failover_unregister);
+
+/*
+ * Return TRUE if we're running under FSL hypervisor
+ *
+ * This function checks to see if we're running under the Freescale
+ * hypervisor, and returns zero if we're not, or non-zero if we are.
+ *
+ * First, it checks if MSR[GS]==1, which means we're running under some
+ * hypervisor. Then it checks if there is a hypervisor node in the device
+ * tree. Currently, that means there needs to be a node in the root called
+ * "hypervisor" and which has a property named "fsl,hv-version".
+ */
+static int has_fsl_hypervisor(void)
+{
+ struct device_node *node;
+ int ret;
+
+ if (!(mfmsr() & MSR_GS))
+ return 0;
+
+ node = of_find_node_by_path("/hypervisor");
+ if (!node)
+ return 0;
+
+ ret = of_find_property(node, "fsl,hv-version", NULL) != NULL;
+
+ of_node_put(node);
+
+ return ret;
+}
+
+/*
+ * Freescale hypervisor management driver init
+ *
+ * This function is called when this module is loaded.
+ *
+ * Register ourselves as a miscellaneous driver. This will register the
+ * fops structure and create the right sysfs entries for udev.
+ */
+static int __init fsl_hypervisor_init(void)
+{
+ struct device_node *np;
+ struct doorbell_isr *dbisr, *n;
+ int ret;
+
+ pr_info("Freescale hypervisor management driver\n");
+
+ if (!has_fsl_hypervisor()) {
+ pr_info("fsl-hv: no hypervisor found\n");
+ return -ENODEV;
+ }
+
+ ret = misc_register(&fsl_hv_misc_dev);
+ if (ret) {
+ pr_err("fsl-hv: cannot register device\n");
+ return ret;
+ }
+
+ INIT_LIST_HEAD(&db_list);
+ INIT_LIST_HEAD(&isr_list);
+
+ for_each_compatible_node(np, NULL, "epapr,hv-receive-doorbell") {
+ unsigned int irq;
+ const uint32_t *handle;
+
+ handle = of_get_property(np, "interrupts", NULL);
+ irq = irq_of_parse_and_map(np, 0);
+ if (!handle || (irq == NO_IRQ)) {
+ pr_err("fsl-hv: no 'interrupts' property in %s node\n",
+ np->full_name);
+ continue;
+ }
+
+ dbisr = kzalloc(sizeof(*dbisr), GFP_KERNEL);
+ if (!dbisr)
+ goto out_of_memory;
+
+ dbisr->irq = irq;
+ dbisr->doorbell = be32_to_cpup(handle);
+
+ if (of_device_is_compatible(np, "fsl,hv-shutdown-doorbell")) {
+ /* The shutdown doorbell gets its own ISR */
+ ret = request_irq(irq, fsl_hv_shutdown_isr, 0,
+ np->name, NULL);
+ } else if (of_device_is_compatible(np,
+ "fsl,hv-state-change-doorbell")) {
+ /* The state change doorbell triggers a notification if
+ * the state of the managed partition changes to
+ * "stopped". We need a separate interrupt handler for
+ * that, and we also need to know the handle of the
+ * target partition, not just the handle of the
+ * doorbell.
+ */
+ dbisr->partition = ret = get_parent_handle(np);
+ if (ret < 0) {
+ pr_err("fsl-hv: node %s has missing or "
+ "malformed parent\n", np->full_name);
+ kfree(dbisr);
+ continue;
+ }
+ ret = request_threaded_irq(irq, fsl_hv_state_change_isr,
+ fsl_hv_state_change_thread,
+ 0, np->name, dbisr);
+ } else
+ ret = request_irq(irq, fsl_hv_isr, 0, np->name, dbisr);
+
+ if (ret < 0) {
+ pr_err("fsl-hv: could not request irq %u for node %s\n",
+ irq, np->full_name);
+ kfree(dbisr);
+ continue;
+ }
+
+ list_add(&dbisr->list, &isr_list);
+
+ pr_info("fsl-hv: registered handler for doorbell %u\n",
+ *handle);
+ }
+
+ return 0;
+
+out_of_memory:
+ list_for_each_entry_safe(dbisr, n, &isr_list, list) {
+ free_irq(dbisr->irq, dbisr);
+ list_del(&dbisr->list);
+ kfree(dbisr);
+ }
+
+ misc_deregister(&fsl_hv_misc_dev);
+
+ return -ENOMEM;
+}
+
+/*
+ * Freescale hypervisor management driver termination
+ *
+ * This function is called when this driver is unloaded.
+ */
+static void __exit fsl_hypervisor_exit(void)
+{
+ struct doorbell_isr *dbisr, *n;
+
+ list_for_each_entry_safe(dbisr, n, &isr_list, list) {
+ free_irq(dbisr->irq, dbisr);
+ list_del(&dbisr->list);
+ kfree(dbisr);
+ }
+
+ misc_deregister(&fsl_hv_misc_dev);
+}
+
+module_init(fsl_hypervisor_init);
+module_exit(fsl_hypervisor_exit);
+
+MODULE_AUTHOR("Timur Tabi <timur@freescale.com>");
+MODULE_DESCRIPTION("Freescale hypervisor management driver");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 75cf611..68c341a 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -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
diff --git a/include/linux/fsl_hypervisor.h b/include/linux/fsl_hypervisor.h
new file mode 100644
index 0000000..4d1e11a
--- /dev/null
+++ b/include/linux/fsl_hypervisor.h
@@ -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
+ * 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.
+ *
+ * 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
+ * via the ioctl interface.
+ */
+
+#ifndef FSL_HYPERVISOR_H
+#define FSL_HYPERVISOR_H
+
+#include <linux/types.h>
+
+/**
+ * struct fsl_hv_ioctl_restart: restart a partition
+ * @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 */
+ 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
+ *
+ * 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
+ */
+int fsl_hv_failover_unregister(struct notifier_block *nb);
+
+#endif
+
+#endif
--
1.7.3.4
^ permalink raw reply related
* Re: [PATCH] powerpc: dtc: remove obsolete .gitignore entries
From: Grant Likely @ 2011-06-08 22:16 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linuxppc-dev
In-Reply-To: <20110608204947.GG21996@pengutronix.de>
On Wed, Jun 08, 2011 at 10:49:47PM +0200, Wolfram Sang wrote:
> On Thu, Mar 31, 2011 at 09:58:34AM -0600, Grant Likely wrote:
> > On Sat, Mar 12, 2011 at 05:44:10PM +0100, Wolfram Sang wrote:
> > > dtc was moved and .gitignores have been added to the new location. So, we can
> > > delete the old, forgotten ones.
> > >
> > > Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> > > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >
> > It's Ben's jurisdiction, but I've picked it up into my
> > devicetree/merge branch anyway. If I don't hear from Ben either way
> > then I'll push it out to Linus next week.
>
> I can't find it there?
Arg, I lost it. I just pushed it out to devicetree/next
g.
^ permalink raw reply
* Re: [PATCH] powerpc: dtc: remove obsolete .gitignore entries
From: Wolfram Sang @ 2011-06-08 20:49 UTC (permalink / raw)
To: Grant Likely; +Cc: linuxppc-dev
In-Reply-To: <20110331155834.GE26709@ponder.secretlab.ca>
[-- Attachment #1: Type: text/plain, Size: 734 bytes --]
On Thu, Mar 31, 2011 at 09:58:34AM -0600, Grant Likely wrote:
> On Sat, Mar 12, 2011 at 05:44:10PM +0100, Wolfram Sang wrote:
> > dtc was moved and .gitignores have been added to the new location. So, we can
> > delete the old, forgotten ones.
> >
> > Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> It's Ben's jurisdiction, but I've picked it up into my
> devicetree/merge branch anyway. If I don't hear from Ben either way
> then I'll push it out to Linus next week.
I can't find it there?
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* powerpc/p1022ds: add missing iounmap calls to platform file
From: Timur Tabi @ 2011-06-08 20:01 UTC (permalink / raw)
To: kumar.gala, linuxppc-dev
The platform file for the Freecale P1022DS reference board is not freeing
the ioremap() mapping of the PIXIS and global utilities nodes it creates.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
arch/powerpc/platforms/85xx/p1022_ds.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
index 7eb5c40..e083e1f 100644
--- a/arch/powerpc/platforms/85xx/p1022_ds.c
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -129,6 +129,7 @@ static void p1022ds_set_gamma_table(int monitor_port, char *gamma_table_base)
static void p1022ds_set_monitor_port(int monitor_port)
{
struct device_node *pixis_node;
+ void __iomem *pixis;
u8 __iomem *brdcfg1;
pixis_node = of_find_compatible_node(NULL, NULL, "fsl,p1022ds-pixis");
@@ -137,12 +138,12 @@ static void p1022ds_set_monitor_port(int monitor_port)
return;
}
- brdcfg1 = of_iomap(pixis_node, 0);
- if (!brdcfg1) {
+ pixis = of_iomap(pixis_node, 0);
+ if (!pixis) {
pr_err("p1022ds: could not map ngPIXIS registers\n");
return;
}
- brdcfg1 += 9; /* BRDCFG1 is at offset 9 in the ngPIXIS */
+ brdcfg1 = pixis + 9; /* BRDCFG1 is at offset 9 in the ngPIXIS */
switch (monitor_port) {
case 0: /* DVI */
@@ -158,6 +159,8 @@ static void p1022ds_set_monitor_port(int monitor_port)
default:
pr_err("p1022ds: unsupported monitor port %i\n", monitor_port);
}
+
+ iounmap(pixis);
}
/**
@@ -201,6 +204,8 @@ void p1022ds_set_pixel_clock(unsigned int pixclock)
/* Enable the clock and set the pxclk */
setbits32(&guts->clkdvdr, CLKDVDR_PXCKEN | (pxclk << 16));
+
+ iounmap(guts);
}
/**
--
1.7.3.4
^ permalink raw reply related
* Re: [PATCH -v2] Audit: push audit success and retcode into arch ptrace.h
From: Oleg Nesterov @ 2011-06-08 19:19 UTC (permalink / raw)
To: Eric Paris
Cc: linux-mips, linux-ia64, linux-sh, heiko.carstens, paulus, hpa,
sparclinux, linux-s390, richard, x86, mingo, fenghua.yu,
user-mode-linux-devel, microblaze-uclinux, jdike, viro, tglx,
monstr, tony.luck, linux-kernel, ralf, lethal, schwidefsky,
linux390, akpm, linuxppc-dev, davem
In-Reply-To: <20110608183720.GA16883@redhat.com>
On 06/08, Oleg Nesterov wrote:
>
> OK. Thanks a lot Eric for your explanations.
Yes. but may I ask another one?
Shouldn't copy_process()->audit_alloc(tsk) path do
clear_tsk_thread_flag(tsk, TIF_SYSCALL_AUDIT) if it doesn't
set tsk->audit_context?
I can be easily wrong, but afaics otherwise the child can run
with TIF_SYSCALL_AUDIT bit copied from parent's thread_info by
dup_task_struct()->setup_thread_stack() and without ->audit_context,
right? For what?
Any other reason why audit_syscall_entry() checks context != NULL?
IOW. Any reason the patch below is wrong?
I am just curious, thanks.
Oleg.
--- x/kernel/auditsc.c
+++ x/kernel/auditsc.c
@@ -885,6 +885,8 @@ int audit_alloc(struct task_struct *tsk)
if (likely(!audit_ever_enabled))
return 0; /* Return if not auditing. */
+ clear_tsk_thread_flag(tsk, TIF_SYSCALL_AUDIT);
+
state = audit_filter_task(tsk, &key);
if (likely(state == AUDIT_DISABLED))
return 0;
@@ -1591,9 +1593,7 @@ void audit_syscall_entry(int arch, int m
struct audit_context *context = tsk->audit_context;
enum audit_state state;
- if (unlikely(!context))
- return;
-
+ BUG_ON(!context);
/*
* This happens only on certain architectures that make system
* calls in kernel_thread via the entry.S interface, instead of
^ permalink raw reply
* [PATCH] [v2] powerpc/p1022ds: fix audio-related properties in the device tree
From: Timur Tabi @ 2011-06-08 19:03 UTC (permalink / raw)
To: kumar.gala, linuxppc-dev
On the Freescale P1022DS reference board, the SSI audio controller is
connected in "asynchronous" mode to the codec's clocks, so the device tree
needs an "fsl,ssi-asynchronous" property.
Also remove the clock-frequency property from the wm8776 node, because
the clock is enabled only if U-Boot enables it, and U-Boot will set the
property if the clock is enabled. A future version of the P1022DS audio
driver will configure the clock itself, but for now, the driver should
not be told that the clock is running when it isn't.
Also fix the FIFO depth to 15, instead of 16.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
arch/powerpc/boot/dts/p1022ds.dts | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/boot/dts/p1022ds.dts b/arch/powerpc/boot/dts/p1022ds.dts
index 4f685a7..98d9426 100644
--- a/arch/powerpc/boot/dts/p1022ds.dts
+++ b/arch/powerpc/boot/dts/p1022ds.dts
@@ -209,8 +209,10 @@
wm8776:codec@1a {
compatible = "wlf,wm8776";
reg = <0x1a>;
- /* MCLK source is a stand-alone oscillator */
- clock-frequency = <12288000>;
+ /*
+ * clock-frequency will be set by U-Boot if
+ * the clock is enabled.
+ */
};
};
@@ -280,7 +282,8 @@
codec-handle = <&wm8776>;
fsl,playback-dma = <&dma00>;
fsl,capture-dma = <&dma01>;
- fsl,fifo-depth = <16>;
+ fsl,fifo-depth = <15>;
+ fsl,ssi-asynchronous;
};
dma@c300 {
--
1.7.3.4
^ permalink raw reply related
* Re: [PATCH -v2] Audit: push audit success and retcode into arch ptrace.h
From: Oleg Nesterov @ 2011-06-08 18:37 UTC (permalink / raw)
To: Eric Paris
Cc: linux-mips, linux-ia64, linux-sh, heiko.carstens, paulus, hpa,
sparclinux, linux-s390, richard, x86, mingo, fenghua.yu,
user-mode-linux-devel, microblaze-uclinux, jdike, viro, tglx,
monstr, tony.luck, linux-kernel, ralf, lethal, schwidefsky,
linux390, akpm, linuxppc-dev, davem
In-Reply-To: <1307556823.2577.5.camel@localhost.localdomain>
On 06/08, Eric Paris wrote:
>
> On Wed, 2011-06-08 at 18:36 +0200, Oleg Nesterov wrote:
> > And I guess, all CONFIG_AUDITSYSCALL code in entry.S is only needed to
> > microoptimize the case when TIF_SYSCALL_AUDIT is the only reason for the
> > slow path. I wonder if it really makes the measureble difference...
>
> All I know is what Roland put in the changelog:
>
> Avoiding the iret return path when syscall audit is enabled helps
> performance a lot.
>
> I believe this was a result of Fedora starting auditd by default and
> then Linus bitching about how slow a null syscall in a tight loop was.
> It was an optimization for a microbenchmark. How much it affects things
> on a real syscall that does real work is probably going to be determined
> by how much work is done in the syscall.
and probably by how much work is done in audit_syscall_entry/exit.
OK. Thanks a lot Eric for your explanations.
Oleg.
^ permalink raw reply
* Re: [PATCH -v2] Audit: push audit success and retcode into arch ptrace.h
From: Eric Paris @ 2011-06-08 18:13 UTC (permalink / raw)
To: Oleg Nesterov
Cc: linux-mips, linux-ia64, linux-sh, heiko.carstens, paulus, hpa,
sparclinux, linux-s390, richard, x86, mingo, fenghua.yu,
user-mode-linux-devel, microblaze-uclinux, jdike, viro, tglx,
monstr, tony.luck, linux-kernel, ralf, lethal, schwidefsky,
linux390, akpm, linuxppc-dev, davem
In-Reply-To: <20110608163653.GA9592@redhat.com>
On Wed, 2011-06-08 at 18:36 +0200, Oleg Nesterov wrote:
> On 06/07, Eric Paris wrote:
> >
> > On Tue, 2011-06-07 at 19:19 +0200, Oleg Nesterov wrote:
> > >
> > > With or without this patch, can't we call audit_syscall_exit() twice
> > > if there is something else in _TIF_WORK_SYSCALL_EXIT mask apart from
> > > SYSCALL_AUDIT ? First time it is called from asm, then from
> > > syscall_trace_leave(), no?
> > >
> > > For example. The task has TIF_SYSCALL_AUDIT and nothing else, it does
> > > system_call->auditsys->system_call_fastpath. What if it gets, say,
> > > TIF_SYSCALL_TRACE before ret_from_sys_call?
> >
> > No harm is done calling twice. The first call will do the real work and
> > cleanup. It will set a flag in the audit data that the work has been
> > done (in_syscall == 0) thus the second call will then not do any real
> > work and won't have anything to clean up.
>
> Hmm... and I assume context->previous != NULL is not possible on x86_64.
> OK, thanks.
>
> And I guess, all CONFIG_AUDITSYSCALL code in entry.S is only needed to
> microoptimize the case when TIF_SYSCALL_AUDIT is the only reason for the
> slow path. I wonder if it really makes the measureble difference...
All I know is what Roland put in the changelog:
Avoiding the iret return path when syscall audit is enabled helps
performance a lot.
I believe this was a result of Fedora starting auditd by default and
then Linus bitching about how slow a null syscall in a tight loop was.
It was an optimization for a microbenchmark. How much it affects things
on a real syscall that does real work is probably going to be determined
by how much work is done in the syscall. (or just disable auditd in
userspace)
-Eric
^ permalink raw reply
* [PATCH] powerpc/p1022ds: fix audio-related properties in the device tree
From: Timur Tabi @ 2011-06-08 17:02 UTC (permalink / raw)
To: kumar.gala, linuxppc-dev
On the Freescale P1022DS reference board, the SSI audio controller is
connected in "asynchronous" mode to the codec's clocks, so the device tree
needs an "fsl,ssi-asynchronous" property.
Also remove the clock-frequency property from the wm8776 node, because
the clock is enabled only if U-Boot enables it, and U-Boot will set the
property if the clock is enabled. A future version of the P1022DS audio
driver will configure the clock itself, but for now, the driver should
not be told that the clock is running when it isn't.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
Without this patch, audio is broken on the P1022DS. I don't know why I missed
this on the initial version of the device tree. I will also post this
patch for the -stable trees.
arch/powerpc/boot/dts/p1022ds.dts | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/boot/dts/p1022ds.dts b/arch/powerpc/boot/dts/p1022ds.dts
index 4f685a7..9255e58 100644
--- a/arch/powerpc/boot/dts/p1022ds.dts
+++ b/arch/powerpc/boot/dts/p1022ds.dts
@@ -209,8 +209,10 @@
wm8776:codec@1a {
compatible = "wlf,wm8776";
reg = <0x1a>;
- /* MCLK source is a stand-alone oscillator */
- clock-frequency = <12288000>;
+ /*
+ * clock-frequency will be set by U-Boot if
+ * the clock is enabled.
+ */
};
};
@@ -281,6 +283,7 @@
fsl,playback-dma = <&dma00>;
fsl,capture-dma = <&dma01>;
fsl,fifo-depth = <16>;
+ fsl,ssi-asynchronous;
};
dma@c300 {
--
1.7.3.4
^ permalink raw reply related
* Re: [gianfar]bandwidth management problem on mpc8313 based board
From: Scott Wood @ 2011-06-08 17:00 UTC (permalink / raw)
To: Vijay Nikam; +Cc: linuxppc-dev
In-Reply-To: <BANLkTino1HgB2SL=S6ZeZ-z3o1MczWJ+8w@mail.gmail.com>
On Wed, 8 Jun 2011 16:21:03 +0530
Vijay Nikam <vijay.t.nikam@gmail.com> wrote:
> Hello Scott,
>
> Thanks for the prompt reply.
>
> > What's your CPU utilization? The CPU may just not be able to keep up with
> > that much traffic, with the software you're running.
> The software I am using to check bandwidth is 'iperf'.
Plus the Linux network stack.
> Without running iperf the
> CPU utilization varies around 30-50% and with iperf running it shoots
> upto 99.9%.
OK, so you're CPU limited.
You might want to try a newer kernel; things may have improved in the past
several years.
If the reason you're running such an old kernel is because you're using the
Freescale BSP, contact Freescale support and ask what performance you're
supposed to be able to get (as well as if they have a newer BSP available).
> > What packet size are you using?
> The packet size is - 1518 + VLAN_Tag (4Bytes) = 1522 Bytes
>
> Another point which I would like to clear is that mpc8313 has eth0 (eTsec1) of
> 1Gbps, if more than 50% of CPU Time is available then why the total bandwidth
> should limit to less than 100 Mbps? At least 400Mbps should be expected, please
> correct if I am wrong!
I assume the remote end isn't CPU limited... Is the test limited by latency
or bandwidth? You're sure that you've actually got a gigabit link
end-to-end? Didn't you say the 30-50% was without running iperf at all --
did you mean running it only on one port?
Beyond that, I guess you'd have to do some debugging to see where the
packets are getting dropped.
-Scott
^ permalink raw reply
* Re: [PATCH -v2] Audit: push audit success and retcode into arch ptrace.h
From: Oleg Nesterov @ 2011-06-08 16:36 UTC (permalink / raw)
To: Eric Paris
Cc: linux-mips, linux-ia64, linux-sh, heiko.carstens, paulus, hpa,
sparclinux, linux-s390, richard, x86, mingo, fenghua.yu,
user-mode-linux-devel, microblaze-uclinux, jdike, viro, tglx,
monstr, tony.luck, linux-kernel, ralf, lethal, schwidefsky,
linux390, akpm, linuxppc-dev, davem
In-Reply-To: <1307472796.2052.12.camel@localhost.localdomain>
On 06/07, Eric Paris wrote:
>
> On Tue, 2011-06-07 at 19:19 +0200, Oleg Nesterov wrote:
> >
> > With or without this patch, can't we call audit_syscall_exit() twice
> > if there is something else in _TIF_WORK_SYSCALL_EXIT mask apart from
> > SYSCALL_AUDIT ? First time it is called from asm, then from
> > syscall_trace_leave(), no?
> >
> > For example. The task has TIF_SYSCALL_AUDIT and nothing else, it does
> > system_call->auditsys->system_call_fastpath. What if it gets, say,
> > TIF_SYSCALL_TRACE before ret_from_sys_call?
>
> No harm is done calling twice. The first call will do the real work and
> cleanup. It will set a flag in the audit data that the work has been
> done (in_syscall == 0) thus the second call will then not do any real
> work and won't have anything to clean up.
Hmm... and I assume context->previous != NULL is not possible on x86_64.
OK, thanks.
And I guess, all CONFIG_AUDITSYSCALL code in entry.S is only needed to
microoptimize the case when TIF_SYSCALL_AUDIT is the only reason for the
slow path. I wonder if it really makes the measureble difference...
Oleg.
^ permalink raw reply
* Re: Hooking up SM501 on TQM5200 (MPC5200) board via device tree?
From: Grant Likely @ 2011-06-08 15:00 UTC (permalink / raw)
To: Josh Triplett; +Cc: devicetree-discuss, linuxppc-dev, linux-kernel, Jamey Sharp
In-Reply-To: <20110608030940.GA18383@leaf>
On Tue, Jun 07, 2011 at 08:09:40PM -0700, Josh Triplett wrote:
> On Fri, Jun 03, 2011 at 02:51:38PM -0600, Grant Likely wrote:
> > On Tue, May 31, 2011 at 10:07:01PM -0700, Josh Triplett wrote:
> > > We have a TQM5200 board, which has GPIO lines hooked up to an SM501.
> > > I've managed to come up with the following patch to the tqm5200 device
> > > tree, which manages to convince the sm501 driver to attach an sm501-fb:
> > >
> > > --- a/arch/powerpc/boot/dts/tqm5200.dts 2009-11-23 03:13:27.000000000 -0800
> > > +++ b/arch/powerpc/boot/dts/tqm5200.dts 2011-05-31 22:00:28.000580627 -0700
> > > @@ -177,7 +177,8 @@
> > > compatible = "fsl,mpc5200-lpb","simple-bus";
> > > #address-cells = <2>;
> > > #size-cells = <1>;
> > > - ranges = <0 0 0xfc000000 0x02000000>;
> > > + ranges = <0 0 0xfc000000 0x02000000
> > > + 1 0 0xe0000000 0x04000000>;
> > >
> > > flash@0,0 {
> > > compatible = "cfi-flash";
> > > @@ -187,6 +188,13 @@
> > > #size-cells = <1>;
> > > #address-cells = <1>;
> > > };
> > > +
> > > + display@1,0 {
> > > + compatible = "smi,sm501";
> > > + reg = <1 0x00000000 0x00800000
> > > + 1 0x03e00000 0x00200000>;
> > > + interrupts = <1 1 3>;
> > > + };
> > > };
> > >
> > > pci@f0000d00 {
> > >
> > >
> > > However, this doesn't hook up the sm501-gpio bits. Reading the sm501
> > > driver carefully, it looks like it only hooks up sm501-gpio if it has
> > > platform_data available which sets some flags and other information.
> > > So, if I understand correctly, hooking up sm501-gpio would require
> > > adding functionality the driver to get the GPIO information from the
> > > device tree in preference to the platform_data, if available, and fall
> > > back to the platform_data for existing users?
> > >
> > > What should the necessary device tree properties look like to replace
> > > sm501_initdata?
> > >
> > > - Josh Triplett
> >
> > You need to look at Documentation/devicetree/bindings/gpio/gpio.txt.
> >
> > Also, you need to add bits to the sm501-gpio driver to register a
> > dynamically allocated range of gpio pins and to populate the
> > gpiochip->of_node pointer. If that points at a device tree node, then
> > the core code will take care of setting up translation for you.
>
> What would the resulting device tree look like, given that the sm501
> driver handles several different types of devices? sm501 doesn't have a
> separate gpio driver; it just has a flag to enable GPIO. The GPIO
> controller also doesn't have independent resources; as far as I can
> tell, the sm501 knows everything it needs to know in order to drive the
> gpio, except the boolean presence or absence of gpio.
>
> Currently, to get the sm501 hooked up at all, I wrote this:
>
> display@1,0 {
> compatible = "smi,sm501";
> reg = <1 0x00000000 0x00800000
> 1 0x03e00000 0x00200000>;
> interrupts = <1 1 3>;
> };
>
> To hook up the gpio, would I nest an entire gpio@... { ...;
> gpio-controller; } stanza inside that or next to that, or just add the
> gpio-controller; and #gpio-cells lines inside the existing stanza for
> the sm501?
Just add gpio-controller and #gpio-cells.
>
> Does the gpio@ bit have any semantic significance, or just the
> gpio-controller line and the compatible line?
Nope, that's just the name and address of the device. It doesn't
affect the gpio binding (although 'pure' gpio controllers should use
the name 'gpio' as a recommended practice).
g.
^ permalink raw reply
* Re: [PATCH] powerpc/85xx:DTS: Fix tbi node location for Px020RDB
From: Grant Likely @ 2011-06-08 14:57 UTC (permalink / raw)
To: Prabhakar Kushwaha; +Cc: meet2prabhu, devicetree-discuss, linuxppc-dev
In-Reply-To: <1307501379-3160-1-git-send-email-prabhakar@freescale.com>
On Wed, Jun 08, 2011 at 08:19:39AM +0530, Prabhakar Kushwaha wrote:
> ten-bit interface (TBI) module is part of SoC not board.
>
> Move tbi entries from board related dts files to Si dts.
>
> Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
Looks okay to me.
g.
> ---
> Based upon http://git.kernel.org/pub/scm/linux/kernel/git/galak/powerpc.git (branch next)
>
> arch/powerpc/boot/dts/p1020rdb.dts | 9 ---------
> arch/powerpc/boot/dts/p1020rdb_camp_core0.dts | 8 --------
> arch/powerpc/boot/dts/p1020si.dtsi | 6 +++++-
> arch/powerpc/boot/dts/p2020rdb.dts | 8 --------
> arch/powerpc/boot/dts/p2020rdb_camp_core0.dts | 8 --------
> arch/powerpc/boot/dts/p2020si.dtsi | 6 +++++-
> 6 files changed, 10 insertions(+), 35 deletions(-)
>
> diff --git a/arch/powerpc/boot/dts/p1020rdb.dts b/arch/powerpc/boot/dts/p1020rdb.dts
> index d6a8ae4..a4e5d6c 100644
> --- a/arch/powerpc/boot/dts/p1020rdb.dts
> +++ b/arch/powerpc/boot/dts/p1020rdb.dts
> @@ -211,14 +211,6 @@
> };
> };
>
> - mdio@25000 {
> -
> - tbi0: tbi-phy@11 {
> - reg = <0x11>;
> - device_type = "tbi-phy";
> - };
> - };
> -
> enet0: ethernet@b0000 {
> fixed-link = <1 1 1000 0 0>;
> phy-connection-type = "rgmii-id";
> @@ -227,7 +219,6 @@
>
> enet1: ethernet@b1000 {
> phy-handle = <&phy0>;
> - tbi-handle = <&tbi0>;
> phy-connection-type = "sgmii";
>
> };
> diff --git a/arch/powerpc/boot/dts/p1020rdb_camp_core0.dts b/arch/powerpc/boot/dts/p1020rdb_camp_core0.dts
> index f0bf7f4..abab234 100644
> --- a/arch/powerpc/boot/dts/p1020rdb_camp_core0.dts
> +++ b/arch/powerpc/boot/dts/p1020rdb_camp_core0.dts
> @@ -114,20 +114,12 @@
> };
> };
>
> - mdio@25000 {
> - tbi0: tbi-phy@11 {
> - reg = <0x11>;
> - device_type = "tbi-phy";
> - };
> - };
> -
> enet0: ethernet@b0000 {
> status = "disabled";
> };
>
> enet1: ethernet@b1000 {
> phy-handle = <&phy0>;
> - tbi-handle = <&tbi0>;
> phy-connection-type = "sgmii";
> };
>
> diff --git a/arch/powerpc/boot/dts/p1020si.dtsi b/arch/powerpc/boot/dts/p1020si.dtsi
> index 5c5acb6..7844d2e 100644
> --- a/arch/powerpc/boot/dts/p1020si.dtsi
> +++ b/arch/powerpc/boot/dts/p1020si.dtsi
> @@ -190,7 +190,10 @@
> #size-cells = <0>;
> compatible = "fsl,etsec2-tbi";
> reg = <0x25000 0x1000 0xb1030 0x4>;
> -
> + tbi0: tbi-phy@11 {
> + reg = <0x11>;
> + device_type = "tbi-phy";
> + };
> };
>
> enet0: ethernet@b0000 {
> @@ -229,6 +232,7 @@
> fsl,num_tx_queues = <0x8>;
> local-mac-address = [ 00 00 00 00 00 00 ];
> interrupt-parent = <&mpic>;
> + tbi-handle = <&tbi0>;
>
> queue-group@0 {
> #address-cells = <1>;
> diff --git a/arch/powerpc/boot/dts/p2020rdb.dts b/arch/powerpc/boot/dts/p2020rdb.dts
> index 1d7a05f..2941cbb 100644
> --- a/arch/powerpc/boot/dts/p2020rdb.dts
> +++ b/arch/powerpc/boot/dts/p2020rdb.dts
> @@ -213,13 +213,6 @@
> };
> };
>
> - mdio@25520 {
> - tbi0: tbi-phy@11 {
> - reg = <0x11>;
> - device_type = "tbi-phy";
> - };
> - };
> -
> mdio@26520 {
> status = "disabled";
> };
> @@ -243,7 +236,6 @@
> };
>
> enet1: ethernet@25000 {
> - tbi-handle = <&tbi0>;
> phy-handle = <&phy0>;
> phy-connection-type = "sgmii";
> };
> diff --git a/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts b/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts
> index fc8dddd..4641f3d 100644
> --- a/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts
> +++ b/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts
> @@ -124,13 +124,6 @@
> };
> };
>
> - mdio@25520 {
> - tbi0: tbi-phy@11 {
> - reg = <0x11>;
> - device_type = "tbi-phy";
> - };
> - };
> -
> mdio@26520 {
> status = "disabled";
> };
> @@ -140,7 +133,6 @@
> };
>
> enet1: ethernet@25000 {
> - tbi-handle = <&tbi0>;
> phy-handle = <&phy0>;
> phy-connection-type = "sgmii";
>
> diff --git a/arch/powerpc/boot/dts/p2020si.dtsi b/arch/powerpc/boot/dts/p2020si.dtsi
> index 6def17f..9317075 100644
> --- a/arch/powerpc/boot/dts/p2020si.dtsi
> +++ b/arch/powerpc/boot/dts/p2020si.dtsi
> @@ -235,6 +235,10 @@
> #size-cells = <0>;
> compatible = "fsl,gianfar-tbi";
> reg = <0x26520 0x20>;
> + tbi0: tbi-phy@11 {
> + reg = <0x11>;
> + device_type = "tbi-phy";
> + };
> };
>
> mdio@26520 {
> @@ -270,7 +274,7 @@
> local-mac-address = [ 00 00 00 00 00 00 ];
> interrupts = <35 2 36 2 40 2>;
> interrupt-parent = <&mpic>;
> -
> + tbi-handle = <&tbi0>;
> };
>
> enet2: ethernet@26000 {
> --
> 1.7.3
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
^ permalink raw reply
* Re: [PATCH -v2] Audit: push audit success and retcode into arch ptrace.h
From: Ralf Baechle @ 2011-06-08 14:04 UTC (permalink / raw)
To: Eric Paris
Cc: linux-mips, linux-ia64, linux-sh, heiko.carstens, oleg, paulus,
hpa, sparclinux, linux-s390, richard, x86, mingo, fenghua.yu,
user-mode-linux-devel, microblaze-uclinux, jdike, viro, tglx,
monstr, tony.luck, linux-kernel, lethal, schwidefsky, linux390,
akpm, linuxppc-dev, davem
In-Reply-To: <20110603220451.23134.47368.stgit@paris.rdu.redhat.com>
On Fri, Jun 03, 2011 at 06:04:51PM -0400, Eric Paris wrote:
Thanks, this looks good & compiles, so:
Acked-by: Ralf Baechle <ralf@linux-mips.org>
I will rebase my pending MIPS audit patches on top of this patch and resend.
Thanks,
Ralf
^ permalink raw reply
* RE: [gianfar]bandwidth management problem on mpc8313 based board
From: David Laight @ 2011-06-08 11:25 UTC (permalink / raw)
To: Vijay Nikam, linuxppc-dev
In-Reply-To: <BANLkTi=TVsXiWR1qS5upnM31kVk9qqXTmw@mail.gmail.com>
> Subject: [gianfar]bandwidth management problem on mpc8313 based board
...
> I have mpc8313 powerpc based board with silicon revision 2.1. the
> processor has two ETH ports (eTsec1 and eTsec2) i.e. eth0 and eth1.
> eth0 is 1Gbps port and eth1 is 100Mbps port. On board there is L2
> switch from TANTOS2G (psb6972) supports one port 1Gbps,
> and from switch there are 4 more eth ports derived which are 100Mbps
> ports and port based VLAN is configured for this purpose.
>=20
> The interface between switch and eth0 (port of processor) is RGMII. So
> the processor port and switch port are connected on 1Gbps Link.
...
> After this I started to perform bandwidth test using iperf tool.
> When I performed this test on one port out of 4 derived ports I am
> getting bandwidth in the range of 80-85Mbps
> but when the same test is performed on 2 ports simultaneously then the
> per port bandwidth is reduced to 40-45Mbps.
To summerise, you have a Ge port connected by RGMII (cross over) to
an on-board switch that is configured to use VLAN tagging to drive
four external 100M ports?
I see two likely reasons for the aggregate throughput being constant:
1) The switch has limited throughput/buffering
2) The host really is 100% busy
3) The remote system has limited throughput
I'd vote for the system being busy and 'top' (or whatever you are
using) lying about the cpu usage. Measuring free cpu time by counting
it in a low priority process is much more accurate than relying on
the 'code interrupted by timer tick' scheme.
(Clearly the scheduler could use a high-res timestamp on entry/exit
to the idle loop and/or process switch - but, to my knowledge, the
linux kernel only uses the timer interrupt.)
David
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox