Re: [Xen-devel] [PATCH v4 6/6] xen: arm: Import of_bus PCI entry from Linux (as a dt_bus entry)
On Fri, 2015-07-03 at 12:24 +0100, Julien Grall wrote: On 03/07/15 11:56, Ian Campbell wrote: On Fri, 2015-07-03 at 11:47 +0100, Ian Campbell wrote: On Fri, 2015-06-26 at 20:08 +0200, Julien Grall wrote: Hi Ian, On 08/05/2015 13:27, Ian Campbell wrote: This provides specific handlers for the PCI bus relating to matching and translating. It's mostly similar to the defaults but includes some additional error checks and other PCI specific bits. I though the previous patch (#5) was enough to handle PCI. May I ask why we need it? There are some subtle differences in how the generic code vs. the pci specific code here will handle buggy DTs (i.e. #*-cells which are not as required by the pci bindings). This will mean we tolerate such device trees better. I say buggy, but actually it's not clear to me from reading PCI Bus Binding to Open Firmware that when the device_type is pci that #*-cells shouldn't be assumed to have the values given in that text, e.g. the text says The value of #address-cells for PCI Bus Nodes is 3. and not A PCI Bus Node must contain a #address-cells property containing 3. Maybe that interpretation is bogus, but with this patch we are are able to cope with DTs written by people who do read it like that. If the #address-cells and #size-cells are not correct that will likely means that the property reg in the PCI node would be misinterpreted by Xen. Right, everything falls apart in that case anyway, unless the #*-cells properties are inconsistent with a regs which correctly follows the spec, but that's the most unlikely case I think. I think it's here to cope with DT when #*-cells are not specified. The spec doesn't say if the properties should be present or not. Right. ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v4 6/6] xen: arm: Import of_bus PCI entry from Linux (as a dt_bus entry)
On Fri, 2015-06-26 at 20:08 +0200, Julien Grall wrote: Hi Ian, On 08/05/2015 13:27, Ian Campbell wrote: This provides specific handlers for the PCI bus relating to matching and translating. It's mostly similar to the defaults but includes some additional error checks and other PCI specific bits. I though the previous patch (#5) was enough to handle PCI. May I ask why we need it? There are some subtle differences in how the generic code vs. the pci specific code here will handle buggy DTs (i.e. #*-cells which are not as required by the pci bindings). This will mean we tolerate such device trees better. I say buggy, but actually it's not clear to me from reading PCI Bus Binding to Open Firmware that when the device_type is pci that #*-cells shouldn't be assumed to have the values given in that text, e.g. the text says The value of #address-cells for PCI Bus Nodes is 3. and not A PCI Bus Node must contain a #address-cells property containing 3. Maybe that interpretation is bogus, but with this patch we are are able to cope with DTs written by people who do read it like that. FWIW it also gets us the ability to parse the flags (cacheability), although at the moment we only check them for validity rather than use them. Functions/types renamed and reindented (because apparently we do that for these). My mistake, when I first port the functions from Linux I changed the name and the coding style to match the existent functions in xen/common/device_tree.c All the functions to work directly on the DT blob have been moved in a separate file (arch/arm/bootfdt.c), so this file is mostly Linux code. I'm thinking to resync it correctly for Xen 4.7. That sounds good, thanks. Needs a selection of IORESOURCE_* defines, which I've taken from Linux and have included locally for now until we figure out where else they might be needed. Regards, ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v4 6/6] xen: arm: Import of_bus PCI entry from Linux (as a dt_bus entry)
On Fri, 2015-07-03 at 11:47 +0100, Ian Campbell wrote: On Fri, 2015-06-26 at 20:08 +0200, Julien Grall wrote: Hi Ian, On 08/05/2015 13:27, Ian Campbell wrote: This provides specific handlers for the PCI bus relating to matching and translating. It's mostly similar to the defaults but includes some additional error checks and other PCI specific bits. I though the previous patch (#5) was enough to handle PCI. May I ask why we need it? There are some subtle differences in how the generic code vs. the pci specific code here will handle buggy DTs (i.e. #*-cells which are not as required by the pci bindings). This will mean we tolerate such device trees better. I say buggy, but actually it's not clear to me from reading PCI Bus Binding to Open Firmware that when the device_type is pci that #*-cells shouldn't be assumed to have the values given in that text, e.g. the text says The value of #address-cells for PCI Bus Nodes is 3. and not A PCI Bus Node must contain a #address-cells property containing 3. Maybe that interpretation is bogus, but with this patch we are are able to cope with DTs written by people who do read it like that. FWIW it also gets us the ability to parse the flags (cacheability), although at the moment we only check them for validity rather than use them. I've pasted a slightly adjusted version of this into the commit message for v5. Functions/types renamed and reindented (because apparently we do that for these). My mistake, when I first port the functions from Linux I changed the name and the coding style to match the existent functions in xen/common/device_tree.c All the functions to work directly on the DT blob have been moved in a separate file (arch/arm/bootfdt.c), so this file is mostly Linux code. I'm thinking to resync it correctly for Xen 4.7. That sounds good, thanks. Needs a selection of IORESOURCE_* defines, which I've taken from Linux and have included locally for now until we figure out where else they might be needed. Regards, ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v4 6/6] xen: arm: Import of_bus PCI entry from Linux (as a dt_bus entry)
On 03/07/15 11:56, Ian Campbell wrote: On Fri, 2015-07-03 at 11:47 +0100, Ian Campbell wrote: On Fri, 2015-06-26 at 20:08 +0200, Julien Grall wrote: Hi Ian, On 08/05/2015 13:27, Ian Campbell wrote: This provides specific handlers for the PCI bus relating to matching and translating. It's mostly similar to the defaults but includes some additional error checks and other PCI specific bits. I though the previous patch (#5) was enough to handle PCI. May I ask why we need it? There are some subtle differences in how the generic code vs. the pci specific code here will handle buggy DTs (i.e. #*-cells which are not as required by the pci bindings). This will mean we tolerate such device trees better. I say buggy, but actually it's not clear to me from reading PCI Bus Binding to Open Firmware that when the device_type is pci that #*-cells shouldn't be assumed to have the values given in that text, e.g. the text says The value of #address-cells for PCI Bus Nodes is 3. and not A PCI Bus Node must contain a #address-cells property containing 3. Maybe that interpretation is bogus, but with this patch we are are able to cope with DTs written by people who do read it like that. If the #address-cells and #size-cells are not correct that will likely means that the property reg in the PCI node would be misinterpreted by Xen. I think it's here to cope with DT when #*-cells are not specified. The spec doesn't say if the properties should be present or not. FWIW it also gets us the ability to parse the flags (cacheability), although at the moment we only check them for validity rather than use them. Good point. I've pasted a slightly adjusted version of this into the commit message for v5. Thank you! Regards, -- Julien Grall ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v4 6/6] xen: arm: Import of_bus PCI entry from Linux (as a dt_bus entry)
Hi Ian, On 08/05/2015 13:27, Ian Campbell wrote: This provides specific handlers for the PCI bus relating to matching and translating. It's mostly similar to the defaults but includes some additional error checks and other PCI specific bits. I though the previous patch (#5) was enough to handle PCI. May I ask why we need it? Functions/types renamed and reindented (because apparently we do that for these). My mistake, when I first port the functions from Linux I changed the name and the coding style to match the existent functions in xen/common/device_tree.c All the functions to work directly on the DT blob have been moved in a separate file (arch/arm/bootfdt.c), so this file is mostly Linux code. I'm thinking to resync it correctly for Xen 4.7. Needs a selection of IORESOURCE_* defines, which I've taken from Linux and have included locally for now until we figure out where else they might be needed. Regards, -- Julien Grall ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel