* [Qemu-devel] [PATCH] hw/arm/virt: "bus-range"/end is off by one
@ 2015-02-12 18:50 Laszlo Ersek
2015-02-12 19:40 ` Wei Huang
2015-02-13 1:12 ` Alexander Graf
0 siblings, 2 replies; 4+ messages in thread
From: Laszlo Ersek @ 2015-02-12 18:50 UTC (permalink / raw)
To: agraf, peter.maydell, qemu-devel, lersek
According to "PCI Bus Binding to IEEE Std 1275-1994", 3.1.2. Bus-specific
Properties for Bus Nodes, the second integer in "bus-range" is an
inclusive limit.
This seems to be consistent with several *.dtsi files in the kernel tree,
where examples like
bus-range = <0 0>;
are visible.
In addition, the loop in gen_pci_parse_map_cfg_windows()
[drivers/pci/host/pci-host-generic.c] uses "bus_range->end" as an
inclusive limit.
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
Notes:
Applies on top of target-arm.next.
hw/arm/virt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index a2a5c96..ee77093 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -693,7 +693,8 @@ static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic,
qemu_fdt_setprop_string(vbi->fdt, nodename, "device_type", "pci");
qemu_fdt_setprop_cell(vbi->fdt, nodename, "#address-cells", 3);
qemu_fdt_setprop_cell(vbi->fdt, nodename, "#size-cells", 2);
- qemu_fdt_setprop_cells(vbi->fdt, nodename, "bus-range", 0, nr_pcie_buses);
+ qemu_fdt_setprop_cells(vbi->fdt, nodename, "bus-range", 0,
+ nr_pcie_buses - 1);
qemu_fdt_setprop_sized_cells(vbi->fdt, nodename, "reg",
2, base_ecam, 2, size_ecam);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/virt: "bus-range"/end is off by one
2015-02-12 18:50 [Qemu-devel] [PATCH] hw/arm/virt: "bus-range"/end is off by one Laszlo Ersek
@ 2015-02-12 19:40 ` Wei Huang
2015-02-13 1:12 ` Alexander Graf
1 sibling, 0 replies; 4+ messages in thread
From: Wei Huang @ 2015-02-12 19:40 UTC (permalink / raw)
To: Laszlo Ersek, agraf, peter.maydell, qemu-devel
On 02/12/2015 12:50 PM, Laszlo Ersek wrote:
> According to "PCI Bus Binding to IEEE Std 1275-1994", 3.1.2. Bus-specific
> Properties for Bus Nodes, the second integer in "bus-range" is an
> inclusive limit.
>
> This seems to be consistent with several *.dtsi files in the kernel tree,
> where examples like
>
> bus-range = <0 0>;
>
> are visible.
>
> In addition, the loop in gen_pci_parse_map_cfg_windows()
> [drivers/pci/host/pci-host-generic.c] uses "bus_range->end" as an
> inclusive limit.
>
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>
> Notes:
> Applies on top of target-arm.next.
>
> hw/arm/virt.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index a2a5c96..ee77093 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -693,7 +693,8 @@ static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic,
> qemu_fdt_setprop_string(vbi->fdt, nodename, "device_type", "pci");
> qemu_fdt_setprop_cell(vbi->fdt, nodename, "#address-cells", 3);
> qemu_fdt_setprop_cell(vbi->fdt, nodename, "#size-cells", 2);
> - qemu_fdt_setprop_cells(vbi->fdt, nodename, "bus-range", 0, nr_pcie_buses);
> + qemu_fdt_setprop_cells(vbi->fdt, nodename, "bus-range", 0,
> + nr_pcie_buses - 1);
>
> qemu_fdt_setprop_sized_cells(vbi->fdt, nodename, "reg",
> 2, base_ecam, 2, size_ecam);
>
I instrumented a guest VM (of/of_pci.c) to print out the bus range.
Without this patch, bus_range->[start, end]=[0, 16]. So this patch makes
sense to me:
Reviewed-by: Wei Huang <wei@redhat.com>
Thanks,
-Wei
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/virt: "bus-range"/end is off by one
2015-02-12 18:50 [Qemu-devel] [PATCH] hw/arm/virt: "bus-range"/end is off by one Laszlo Ersek
2015-02-12 19:40 ` Wei Huang
@ 2015-02-13 1:12 ` Alexander Graf
2015-02-13 1:13 ` Peter Maydell
1 sibling, 1 reply; 4+ messages in thread
From: Alexander Graf @ 2015-02-13 1:12 UTC (permalink / raw)
To: Laszlo Ersek, peter.maydell, qemu-devel
On 12.02.15 19:50, Laszlo Ersek wrote:
> According to "PCI Bus Binding to IEEE Std 1275-1994", 3.1.2. Bus-specific
> Properties for Bus Nodes, the second integer in "bus-range" is an
> inclusive limit.
>
> This seems to be consistent with several *.dtsi files in the kernel tree,
> where examples like
>
> bus-range = <0 0>;
>
> are visible.
>
> In addition, the loop in gen_pci_parse_map_cfg_windows()
> [drivers/pci/host/pci-host-generic.c] uses "bus_range->end" as an
> inclusive limit.
>
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Nice catch!
Reviewed-by: Alexander Graf <agraf@suse.de>
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/virt: "bus-range"/end is off by one
2015-02-13 1:12 ` Alexander Graf
@ 2015-02-13 1:13 ` Peter Maydell
0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2015-02-13 1:13 UTC (permalink / raw)
To: Alexander Graf; +Cc: Laszlo Ersek, QEMU Developers
On 13 February 2015 at 01:12, Alexander Graf <agraf@suse.de> wrote:
>
>
> On 12.02.15 19:50, Laszlo Ersek wrote:
>> According to "PCI Bus Binding to IEEE Std 1275-1994", 3.1.2. Bus-specific
>> Properties for Bus Nodes, the second integer in "bus-range" is an
>> inclusive limit.
>>
>> This seems to be consistent with several *.dtsi files in the kernel tree,
>> where examples like
>>
>> bus-range = <0 0>;
>>
>> are visible.
>>
>> In addition, the loop in gen_pci_parse_map_cfg_windows()
>> [drivers/pci/host/pci-host-generic.c] uses "bus_range->end" as an
>> inclusive limit.
>>
>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
>
> Nice catch!
>
> Reviewed-by: Alexander Graf <agraf@suse.de>
Since I haven't pushed the pci patches yet I'll just squash
this fix in to them.
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-02-13 1:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-12 18:50 [Qemu-devel] [PATCH] hw/arm/virt: "bus-range"/end is off by one Laszlo Ersek
2015-02-12 19:40 ` Wei Huang
2015-02-13 1:12 ` Alexander Graf
2015-02-13 1:13 ` Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.