Re: [Xen-devel] [PATCH v3 00/24] xen/arm: Add support for non-pci passthrough

2015-02-20 Thread Ian Campbell
On Tue, 2015-01-13 at 14:25 +, Julien Grall wrote:

I've gotten as far as patch #20 but I've run out of time (and it seems
like a good breaking point). I'll look at the last 4 next week.



___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v3 00/24] xen/arm: Add support for non-pci passthrough

2015-02-20 Thread Julien Grall
On 20/02/15 17:18, Ian Campbell wrote:
 On Tue, 2015-01-13 at 14:25 +, Julien Grall wrote:
 
 I've gotten as far as patch #20 but I've run out of time (and it seems
 like a good breaking point). I'll look at the last 4 next week.

Thanks for the review! I will address all the comments next week.

Regards,

-- 
Julien Grall

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v3 00/24] xen/arm: Add support for non-pci passthrough

2015-01-13 Thread Julien Grall
On 13/01/15 14:25, Julien Grall wrote:
 This series has been tested on Midway by assigning the secondary network card
 to a guest (see instruction below). I plan to do futher testing on other
 boards.

I forgot to precise that only changes has only been build tested on x86.

Regards,

-- 
Julien Grall

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [PATCH v3 00/24] xen/arm: Add support for non-pci passthrough

2015-01-13 Thread Julien Grall
Hello all,

This is the third version of this patch series to add support for platform
device passthrough on ARM.

Compare to the previous version [1], the automatic mapping of MMIO/IRQ and
the generation of the device tree has been dropped.

Instead the user will have to:
- Map manually MMIO/IRQ
- Describe the device in the newly partial device tree support
- Specify the list of device protected by an IOMMU to assign to the
guest.

While this solution is primitive, this is allow us to support more complex
device in Xen with an little additionnal work for the user. Attempting to
do it automatically is more difficult because we may not know the dependencies
between devices (for instance a Network card and a phy).

To avoid adding code in DOM0 to manage platform device deassignment, the
user has to add the property xen,passthrough to the device tree node
describing the device. This can be easily done via U-Boot. For instance,
if we want to passthrough the second network card of a Midway server to the
guest. The user will have to add the following line the u-boot script:

fdt set /soc/ethernet@fff51000 xen,passthrough

This series has been tested on Midway by assigning the secondary network card
to a guest (see instruction below). I plan to do futher testing on other
boards.

There is some TODO, mostly related to XSM in different patches (see commit
message or /* TODO: ... */ in the files).

This series is based on my series Find automatically a PPI for DOM0 event
channel IRQ [2] and xen/arm: Resync the SMMU driver with the Linux one [3].
A working tree can be found here:
git://xenbits.xen.org/julieng/xen-unstable.git branch passthrough-v3

Major changes in v3:
- Rework the approach to passthrough a device (xen,passthrough +
  partial device tree).
- Extend the existing hypercalls to assign/deassign device rather than
adding new one.
- Merge series [4] and [5] in this serie.

Major changes in v2:
 - Drop the patch #1 of the previous version
 - Virtual IRQ are not anymore equal to the physical interrupt
 - Move the hypercall to get DT informations for privcmd to domctl
 - Split the domain creation in 2 two parts to allow per guest
 VGIC configuration (such as the number of SPIs).
 - Bunch of typoes, commit improvement, function renaming.

For all changes see in each patch.

I believe, it's better to have a basic support in Xen rather than nothing.
This could be improved later.

Sincerely yours,

[1] http://lists.xen.org/archives/html/xen-devel/2014-07/msg04090.html
[2] http://lists.xenproject.org/archives/html/xen-devel/2014-12/msg01386.html
[3] http://lists.xenproject.org/archives/html/xen-devel/2014-12/msg01612.html
[4] http://lists.xen.org/archives/html/xen-devel/2014-11/msg01672.html
[5] http://lists.xenproject.org/archives/html/xen-devel/2014-07/msg02098.html

=

Instructions to passthrough a non-PCI device

The example will use the secondary network card for the midway server.

1) Mark the device to let Xen knowns the device will be used for passthrough.
This is done in the device tree node describing the device by adding the
property xen,passthrough. The command to do it in U-Boot is:

fdt set /soc/ethernet@fff51000 xen,passthrough

2) Create the partial device tree describing the device. The IRQ are mapped
1:1 to the guest (i.e VIRQ == IRQ). For MMIO will have to find hole in the
guest memory layout (see xen/include/public/arch-arm.h, noted the layout
is not stable and can change between 2 releases version of Xen).

/dts-v1/;

/ {
#address-cells = 2;
#size-cells = 2;

aliases {
net = mac0;
};

passthrough {
compatible = simple-bus;
ranges;
#address-cells = 2;
#size-cells = 2;
mac0: ethernet@1000 {
compatible = calxeda,hb-xgmac;
reg = 0 0x1000 0 0x1000;
interrupts = 0 80 4  0 81 4  0 82 4;
/* dma-coherent can't be set because it requires platform
 * specific code for highbank
 */
/*  dma-coherent; */
};

foo {
my = mac0;
};
};
};

3) Compile the partial guest device with dtc (Device Tree Compiler).
For our purpose, the compiled file will be called guest-midway.dtb and
placed in /root in DOM0.

3) Add the following options in the guest configuration file:

device_tree = /root/guest-midway.dtb
dtdev = [ /soc/ethernet@fff51000 ]
irqs = [ 112, 113, 114 ]
iomem = [ 0xfff51,1@0x1 ]

Cc: manish.ja...@caviumnetworks.com
Cc: suravee.suthikulpa...@amd.com
Cc: andrii.tseglyts...@globallogic.com

Julien Grall (24):
  xen: Extend DOMCTL createdomain to support arch configuration
  xen/arm: Divide GIC initialization in 2 parts
  xen/dts: Allow only IRQ translation that are mapped to main GIC
  xen: guestcopy: Provide an helper to safely copy string from guest