[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] i2c pass-through in mpsoc



On 24/10/17 16:05, Julien Grall wrote:


On 24/10/17 07:45, Jesús Lázaro wrote:
Hi,

Hello,

Please avoid top-posting. I am CC-ing Edgar who might also be able to give some feedback here.

I had a typo in my previous message.

Dom0 has Xen support and I am able to launch different DomU.

DomU has also Xen support for guests following:
https://wiki.xenproject.org/wiki/Mainline_Linux_Kernel_Configs

Dom0 has knowledge, through the device tree, about the I2C but appears as disabled and with xen,passthough property.

If instead of launching Dom0 as primary OS, I launch DomU (they both are very similar), with the I2C in the DT to okay, it appears and can be used, so I2C support is built into the kernel.

The issue is that when being launch as DomU from Dom0, the i2c device does not appear. The main difference is that when in non Xen environment, the i2c is in the amba bus but when in Xen environment, it is in the pass-through simple bus.

I am not sure what you mean here. When I looked at the mpsoc DT (xilinx/zynqmp.dtsi), the i2c is indeed under a node called amba.

But the name of the node is irrelevant here. However the compatible string is "simple-bus" as used in the partial device-tree below.

Did I miss anything?


The passed devicetree is:

/dts-v1/;
/ {
    #address-cells = <0x2>;
    #size-cells = <0x2>;


     passthrough {
         compatible = "simple-bus";
         ranges;
         #address-cells = <0x2>;
         #size-cells = <0x2>;

         misc_clk {
                 #clock-cells = <0x0>;
                 clock-frequency = <0x7735940>;
                 compatible = "fixed-clock";
                 linux,phandle = <0x2>;
                 phandle = <0x2>;
         };

         pd-i2c1 {
                 #power-domain-cells = <0x0>;
This not does not contain any compatible string. Is it normal?

                 pd-id = <0x26>;
                 linux,phandle = <0x1>;
                 phandle = <0x1>;
         };


         i2c@ff030000 {
                 compatible = "cdns,i2c-r1p14", "cdns,i2c-r1p10";
                 status = "okay";
                 interrupts = <0x0 0x12 0x4>;
                 reg = <0x0 0xff030000 0x0 0x1000>;
                 #address-cells = <0x1>;
                 #size-cells = <0x0>;
                 power-domains = <0x1>;
                 clocks = <0x3 0x3e>;
                 clock-frequency = <0x61a80>;
         };
     };
};

The final result is that it does not load the i2c module and does not create the i2c device. It looks like, since it does not find any i2c in the amba, does not bother to load the module. There are not I2C related messages in none of the dmesgs (Dom0, DomU).


Regards,

Jesús

On 23/10/17 12:57, Julien Grall wrote:


On 13/10/17 10:55, Jesús Lázaro wrote:
Hi,

Hello,

Avoiding the dtdev property avoids any error. Now the issue is that, although in the devicetree/passthrough section the i2c appears, the kernel fails to load any drivers and does not create the /dev/i2c device.

The dom0 kernel has XEN support following https://wiki.xenproject.org/wiki/Mainline_Linux_Kernel_Configs

dmesg does not offer any messages regarding issues with the i2c.

I am a bit confused. You say you pass-through to a guest, but speak about Dom0 kernel. So the dmesg is from DomU or Dom0?

Note that when doing platform device passthrough, Dom0 kernel is not involved in the process. The guest will have full access and should detect it via device-tree.

Make sure you have I2C built in your guest kernel.

Cheers,




Hi,

I have added the compatibility for pd-i2c1 (compatible = "xlnx,zynqmp-genpd";) but the result is the same. I do not know if it should be there or not, I was following the example by Xilinx for the gem and it is not there.

What I mean by the node name is that the same kernel+rootfs, if launched normally (with its own devicetree) recognizes the i2c. When launched by Dom0, the only difference is the devicetree and does not load it.

The resulting deviceetree for Dom0, when inside Xen is:

#########################################################
/dts-v1/;

/ {
        compatible = "xen,xenvm-4.8", "xen,xenvm";
        model = "XENVM-4.8";
        interrupt-parent = <0xfde8>;
        #address-cells = <0x2>;
        #size-cells = <0x2>;

        passthrough {
                compatible = "simple-bus";
                ranges;
                #address-cells = <0x2>;
                #size-cells = <0x2>;

                misc_clk {
                        compatible = "fixed-clock";
                        #clock-cells = <0x0>;
                        phandle = <0x2>;
                        clock-frequency = <0x7735940>;
                        linux,phandle = <0x2>;
                };

                i2c@ff030000 {
                        power-domains = <0x1>;
                        compatible = "cdns,i2c-r1p14", "cdns,i2c-r1p10";
                        clocks = <0x3 0x3e>;
                        status = "okay";
                        #address-cells = <0x1>;
                        interrupts = <0x0 0x12 0x4>;
                        #size-cells = <0x0>;
                        reg = <0x0 0xff030000 0x0 0x1000>;
                        clock-frequency = <0x61a80>;
                };

                pd-i2c1 {
                        compatible = "xlnx,zynqmp-genpd";
                        phandle = <0x1>;
                        pd-id = <0x26>;
                        linux,phandle = <0x1>;
                        #power-domain-cells = <0x0>;
                };
        };

        memory@40000000 {
                device_type = "memory";
                reg = <0x0 0x40000000 0x0 0x10000000>;
        };

        psci {
                compatible = "arm,psci-0.2", "arm,psci";
                cpu_on = <0x2>;
                cpu_off = <0x1>;
                method = "hvc";
        };

        interrupt-controller@3001000 {
                compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";
                #interrupt-cells = <0x3>;
                #address-cells = <0x0>;
                phandle = <0xfde8>;
                reg = <0x0 0x3001000 0x0 0x1000 0x0 0x3002000 0x0 0x2000>;
                linux,phandle = <0xfde8>;
                interrupt-controller;
        };

        chosen {
                bootargs = "console=hvc0 rdinit=/sbin/init";
        };

        timer {
                compatible = "arm,armv8-timer";
                interrupt-parent = <0xfde8>;
                interrupts = <0x1 0xd 0xf08 0x1 0xe 0xf08 0x1 0xb 0xf08>;
        };

        cpus {
                #address-cells = <0x1>;
                #size-cells = <0x0>;

                cpu@0 {
                        compatible = "arm,armv8";
                        device_type = "cpu";
                        enable-method = "psci";
                        reg = <0x0>;
                };
        };

        hypervisor {
                compatible = "xen,xen-4.8", "xen,xen";
                interrupt-parent = <0xfde8>;
                interrupts = <0x1 0xf 0xf08>;
                reg = <0x0 0x38000000 0x0 0x1000000>;
        };
};
#########################################################


I have also tried to change the i2c clocks part to <0x2 0x2> to match the misc clock phandle, but the result is the same.

Regards,

Jesús

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxx
https://lists.xen.org/xen-users

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.