[Qemu-devel] [PATCH 4/4] Rename PCI_FUNC_MAX to PCI_FUNCTIONS_PER_DEVICES in pci.[ch]

2010-08-24 Thread Ken CC
PCI_FUNC_MAX is introduced by 6eab3de16d36c48a983366b09d0a0029a5260bc3 and 6fa84913eccec4266a27c81ae88465f6790742b9 which should be safe to rename to PCI_FUNCTIONS_PER_DEVICES. Signed-off-by: Ken CC --- hw/pci.c |4 ++-- hw/pci.h |1 - 2 files changed, 2 insertions(+), 3 deletions

[Qemu-devel] [PATCH 3/4] Check pci slot number against PCIBUS_MAX_DEVICES in parse_pci_devfn

2010-08-24 Thread Ken CC
If pci addr provided from command line is bigger than 32, PCIBUS_MAX_DEVICES, return error -EINVAL. 32 << 3 | 7 == 256 (PCIBUS_MAX_FUNCTIONS) PCIBUS_MAX_FUNCTIONS = PCIBUS_MAX_DEVICES * PCI_FUNCTIONS_PER_DEVICE Signed-off-by: Ken CC --- hw/qdev-properties.c |4 +++- 1 files chan

[Qemu-devel] [PATCH 2/4] pci init: fail qemu if devfn exceeding the max function number supported on bus

2010-08-24 Thread Ken CC
Check if devfn < PCIBUS_MAX_DEVICES * PCI_FUNCTIONS_PER_DEVICE Signed-off-by: Ken CC --- hw/pci.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 9234fe3..fc4becd 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -747,6 +747,7 @@ static PCIDev

[Qemu-devel] [PATCH 1/4] PCI: define PCIBUS_MAX_DEVICES and PCI_FUNCTIONS_PER_DEVICE in pci.h

2010-08-24 Thread Ken CC
And update the max function number used in struct PCIBus{} to PCIBUS_MAX_FUNCTIONS = PCI_FUNCTIONS_PER_DEVICE * PCIBUS_MAX_DEVICES TODO: according to Avi Kivity, PCIBus.devices[] should be renamed to functions[] Signed-off-by: Ken CC --- hw/pci.c |2 +- hw/pci.h |2 ++ 2 files

[Qemu-devel] Re: [PATCH 2/3] pci init: fail qemu if devfn exceeding the max devices number supported on bus

2010-08-23 Thread Ken CC
broken thread, please ignore. On Tue, Aug 24, 2010 at 02:33:51PM +0800, Ken CC wrote: > assert(devfn < PCIBUS_MAX_DEVICES) > > Signed-off-by: Ken CC > --- > hw/pci.c |1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/hw/pci.c b/hw/pci

[Qemu-devel] [PATCH 2/3] pci init: fail qemu if devfn exceeding the max devices number supported on bus

2010-08-23 Thread Ken CC
assert(devfn < PCIBUS_MAX_DEVICES) Signed-off-by: Ken CC --- hw/pci.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 02019a1..1e804da 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -747,6 +747,7 @@ static PCIDevice *do_pci_register_device(PCIDev

[Qemu-devel] [PATCH 3/3] Check pci slot number in parse_pci_devfn

2010-08-23 Thread Ken CC
Define MAX_PCI_SLOTS as 0x1f, if pci addr provided from command line is bigger than 0x1f, return error -EINVAL. 0x1f << 3 | 7 == 255 (PCIBUS_MAX_DEVICES - 1) Signed-off-by: Ken CC --- hw/qdev-properties.c |2 ++ hw/qdev.h|3 +++ 2 files changed, 5 insertions(+), 0 del

[Qemu-devel] [PATCH 3/3] Check pci slot number in parse_pci_devfn

2010-08-23 Thread Ken CC
Define MAX_PCI_SLOTS as 0x1f, if pci addr provided from command line is bigger than 0x1f, return error -EINVAL. 0x1f << 3 | 7 == 255 (PCIBUS_MAX_DEVICES - 1) Signed-off-by: Ken CC --- hw/qdev-properties.c |2 ++ hw/qdev.h|3 +++ 2 files changed, 5 insertions(+), 0 del

[Qemu-devel] [PATCH 2/3] pci init: fail qemu if devfn exceeding the max devices number supported on bus

2010-08-23 Thread Ken CC
assert(devfn < PCIBUS_MAX_DEVICES) Signed-off-by: Ken CC --- hw/pci.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 02019a1..1e804da 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -747,6 +747,7 @@ static PCIDevice *do_pci_register_device(PCIDev

[Qemu-devel] [PATCH 1/3] PCI: define max devices number on PCIBus as PCIBUS_MAX_DEVICES in pci.h

2010-08-23 Thread Ken CC
Signed-off-by: Ken CC --- hw/pci.c |2 +- hw/pci.h |1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 70dbace..02019a1 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -47,7 +47,7 @@ struct PCIBus { pci_hotplug_fn hotplug; DeviceState

Re: [Qemu-devel] [PATCH 2/2] pci init: Check if devfn exceeding the max devices number supported on bus

2010-08-23 Thread Ken CC
-m 2048 -vnc :11 assert() is good to me. and i think checking in the caller should be done too. > On Mon, Aug 23, 2010 at 01:56:31PM +0800, Ken CC wrote: > > > > Check before trying subindexing. > > > > Signed-off-by: Ken CC > >

[Qemu-devel] [PATCH] pci init: Check if devfn exceeding the max devices number supported on bus

2010-08-22 Thread Ken CC
Check before trying subindexing. Signed-off-by: Ken CC --- hw/pci.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index a09fbac..f6f00c6 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -675,6 +675,10 @@ static PCIDevice *do_pci_register_device(PCIDevice

[Qemu-devel] [PATCH 2/2] pci init: Check if devfn exceeding the max devices number supported on bus

2010-08-22 Thread Ken CC
Check before trying subindexing. Signed-off-by: Ken CC --- hw/pci.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index a09fbac..f6f00c6 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -675,6 +675,10 @@ static PCIDevice *do_pci_register_device

[Qemu-devel] [PATCH 1/2] PCI: define max devices number on PCIBus as PCIBus_MAX_DEVICES in pci.h

2010-08-22 Thread Ken CC
Signed-off-by: Ken CC --- hw/pci.c |2 +- hw/pci.h |1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index a98d6f3..a09fbac 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -44,7 +44,7 @@ struct PCIBus { pci_hotplug_fn hotplug; DeviceState

[Qemu-devel] [PATCH 2/2] pci init: Check if devfn exceeding the max devices number supported on bus

2010-08-12 Thread Ken CC
Check before trying subindexing. Signed-off-by: Ken CC --- hw/pci.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index a09fbac..f6f00c6 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -675,6 +675,10 @@ static PCIDevice *do_pci_register_device(PCIDevice

[Qemu-devel] [PATCH] PCI: define max devices number on PCIBus as PCIBus_MAX_DEVICES in pci.h

2010-08-12 Thread Ken CC
Signed-off-by: Ken CC --- hw/pci.c |2 +- hw/pci.h |1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index a98d6f3..a09fbac 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -44,7 +44,7 @@ struct PCIBus { pci_hotplug_fn hotplug; DeviceState

[Qemu-devel] [PATCH] pci init: Check if devfn exceeding the max devices number supported on bus

2010-08-12 Thread Ken CC
Check before trying subindexing. Signed-off-by: Ken CC --- hw/pci.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index a09fbac..f6f00c6 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -675,6 +675,10 @@ static PCIDevice *do_pci_register_device(PCIDevice