From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLzd4-0000w6-Tc for qemu-devel@nongnu.org; Thu, 12 Feb 2015 14:40:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLzcy-0001Td-Nt for qemu-devel@nongnu.org; Thu, 12 Feb 2015 14:40:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33498) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLzcy-0001TX-Au for qemu-devel@nongnu.org; Thu, 12 Feb 2015 14:40:44 -0500 Message-ID: <54DD01B5.5060607@redhat.com> Date: Thu, 12 Feb 2015 13:40:37 -0600 From: Wei Huang MIME-Version: 1.0 References: <1423767013-22935-1-git-send-email-lersek@redhat.com> In-Reply-To: <1423767013-22935-1-git-send-email-lersek@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] hw/arm/virt: "bus-range"/end is off by one List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek , agraf@suse.de, peter.maydell@linaro.org, qemu-devel@nongnu.org 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 > --- > > 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 Thanks, -Wei