Re: [PATCH v4 7/9] pcie_sriov: Release VFs failed to realize

2024-02-13 Thread Akihiko Odaki
On 2024/02/14 16:54, Michael S. Tsirkin wrote: On Wed, Feb 14, 2024 at 02:13:45PM +0900, Akihiko Odaki wrote: Release VFs failed to realize just as we do in unregister_vfs(). Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization (SR/IOV)") Signed-off-by: Akihiko Odaki I

Re: [PATCH v4 7/9] pcie_sriov: Release VFs failed to realize

2024-02-13 Thread Michael S. Tsirkin
On Wed, Feb 14, 2024 at 02:13:45PM +0900, Akihiko Odaki wrote: > Release VFs failed to realize just as we do in unregister_vfs(). > > Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization > (SR/IOV)") > Signed-off-by: Akihiko Odaki Is this fixing an old bug or a bug introdu

Re: [PATCH v4 6/9] pcie_sriov: Reuse SR-IOV VF device instances

2024-02-13 Thread Michael S. Tsirkin
On Wed, Feb 14, 2024 at 02:13:44PM +0900, Akihiko Odaki wrote: > Disable SR-IOV VF devices by reusing code to power down PCI devices > instead of removing them when the guest requests to disable VFs. This > allows to realize devices and report VF realization errors at PF > realization time. > > Si

Re: [PATCH v4 9/9] hw/nvme: Refer to dev->exp.sriov_pf.num_vfs

2024-02-13 Thread Michael S. Tsirkin
On Wed, Feb 14, 2024 at 02:13:47PM +0900, Akihiko Odaki wrote: > NumVFs may not equal to the current effective number of VFs because VF > Enable is cleared, NumVFs is set after VF Enable is set, or NumVFs is > greater than TotalVFs. > > Fixes: 11871f53ef8e ("hw/nvme: Add support for the Virtualiza

Re: [PATCH v4 8/9] pcie_sriov: Do not reset NumVFs after unregistering VFs

2024-02-13 Thread Michael S. Tsirkin
On Wed, Feb 14, 2024 at 02:13:46PM +0900, Akihiko Odaki wrote: > I couldn't find such a behavior specified. Is it fixing a bug or just removing unnecessary code? Is this guest visible at all? > Signed-off-by: Akihiko Odaki > --- > hw/pci/pcie_sriov.c | 1 - > 1 file changed, 1 deletion(-) > >

Re: [PATCH v4 5/9] pcie_sriov: Validate NumVFs

2024-02-13 Thread Michael S. Tsirkin
On Wed, Feb 14, 2024 at 02:13:43PM +0900, Akihiko Odaki wrote: > The guest may write NumVFs greater than TotalVFs and that can lead > to buffer overflow in VF implementations. > > Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization > (SR/IOV)") > Signed-off-by: Akihiko Odak

Re: [PATCH v4 2/9] hw/pci: Determine if rombar is explicitly enabled

2024-02-13 Thread Michael S. Tsirkin
On Wed, Feb 14, 2024 at 02:13:40PM +0900, Akihiko Odaki wrote: > vfio determines if rombar is explicitly enabled by inspecting QDict. > Inspecting QDict is not nice because QDict is untyped and depends on the > details on the external interface. Add an infrastructure to determine if > rombar is exp

[PATCH v4 5/9] pcie_sriov: Validate NumVFs

2024-02-13 Thread Akihiko Odaki
The guest may write NumVFs greater than TotalVFs and that can lead to buffer overflow in VF implementations. Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization (SR/IOV)") Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 3 +++ 1 file changed, 3 insertions(+) diff

[PATCH v4 9/9] hw/nvme: Refer to dev->exp.sriov_pf.num_vfs

2024-02-13 Thread Akihiko Odaki
NumVFs may not equal to the current effective number of VFs because VF Enable is cleared, NumVFs is set after VF Enable is set, or NumVFs is greater than TotalVFs. Fixes: 11871f53ef8e ("hw/nvme: Add support for the Virtualization Management command") Signed-off-by: Akihiko Odaki --- hw/nvme/ctr

[PATCH v4 7/9] pcie_sriov: Release VFs failed to realize

2024-02-13 Thread Akihiko Odaki
Release VFs failed to realize just as we do in unregister_vfs(). Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization (SR/IOV)") Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sri

[PATCH v4 2/9] hw/pci: Determine if rombar is explicitly enabled

2024-02-13 Thread Akihiko Odaki
vfio determines if rombar is explicitly enabled by inspecting QDict. Inspecting QDict is not nice because QDict is untyped and depends on the details on the external interface. Add an infrastructure to determine if rombar is explicitly enabled to hw/pci. Signed-off-by: Akihiko Odaki --- include/

[PATCH v4 6/9] pcie_sriov: Reuse SR-IOV VF device instances

2024-02-13 Thread Akihiko Odaki
Disable SR-IOV VF devices by reusing code to power down PCI devices instead of removing them when the guest requests to disable VFs. This allows to realize devices and report VF realization errors at PF realization time. Signed-off-by: Akihiko Odaki --- docs/pcie_sriov.txt | 8 ++-- in

[PATCH v4 8/9] pcie_sriov: Do not reset NumVFs after unregistering VFs

2024-02-13 Thread Akihiko Odaki
I couldn't find such a behavior specified. Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 9d668b8d6c17..410bc090fc58 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -209,7 +209,

[PATCH v4 3/9] vfio: Avoid inspecting option QDict for rombar

2024-02-13 Thread Akihiko Odaki
Use pci_rom_bar_explicitly_enabled() to determine if rombar is explicitly enabled. Signed-off-by: Akihiko Odaki --- hw/vfio/pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 4fa387f0430d..647f15b2a060 100644 --- a/hw/vfio/pci.c +++ b/

[PATCH v4 1/9] hw/pci: Use -1 as a default value for rombar

2024-02-13 Thread Akihiko Odaki
Currently there is no way to distinguish the case that rombar is explicitly specified as 1 and the case that rombar is not specified. Set rombar -1 by default to distinguish these cases just as it is done for addr and romsize. It was confirmed that changing the default value to -1 will not change

[PATCH v4 4/9] hw/qdev: Remove opts member

2024-02-13 Thread Akihiko Odaki
It is no longer used. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé --- include/hw/qdev-core.h | 4 hw/core/qdev.c | 1 - system/qdev-monitor.c | 12 +++- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/hw/qdev-core.h b/include/

[PATCH v4 0/9] hw/pci: SR-IOV related fixes and improvements

2024-02-13 Thread Akihiko Odaki
I submitted a RFC series[1] to add support for SR-IOV emulation to virtio-net-pci. During the development of the series, I fixed some trivial bugs and made improvements that I think are independently useful. This series extracts those fixes and improvements from the RFC series. Below is an explanat

Re: [PATCH 3/3] monitor: only run coroutine commands in qemu_aio_context

2024-02-13 Thread Stefan Hajnoczi
On Sat, 3 Feb 2024 at 06:30, Michael Tokarev wrote: > > 03.02.2024 12:01, Michael Tokarev wrote: > ... > > This change broke something in 7.2. I'm still debugging it, will > > come with a follow-up once some more details are found, I'll also > > check current master with and without this commit. >

Re: [PATCH v4 11/12] hw/sparc/leon3: Initialize GPIO before realizing CPU devices

2024-02-13 Thread Mark Cave-Ayland
On 13/02/2024 13:03, Philippe Mathieu-Daudé wrote: Inline cpu_create() in order to call qdev_init_gpio_in_named_with_opaque() before the CPU is realized. Note that with the previous new patch included in the series, qdev_init_gpio_in_named_with_opaque() should be replaced by qdev_init_gpio_i

Re: [PATCH v4 10/12] hw/sparc/leon3: Pass DeviceState opaque argument to leon3_set_pil_in()

2024-02-13 Thread Mark Cave-Ayland
On 13/02/2024 13:03, Philippe Mathieu-Daudé wrote: By passing a DeviceState context to a QDev IRQ handler, we can simplify and use qdev_init_gpio_in_named() instead of qdev_init_gpio_in_named_with_opaque(). Suggested-by: Mark Cave-Ayland Signed-off-by: Philippe Mathieu-Daudé --- hw/sparc/le

Re: [PATCH v4 06/12] hw/misc/macio: Realize IDE controller before accessing it

2024-02-13 Thread BALATON Zoltan
On Tue, 13 Feb 2024, Philippe Mathieu-Daudé wrote: We should not wire IRQs on unrealized device. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Mark Cave-Ayland Reviewed-by: BALATON Zoltan --- hw/misc/macio/macio.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --

Re: [PATCH v4 04/12] hw/i386/q35: Realize LPC PCI function before accessing it

2024-02-13 Thread BALATON Zoltan
On Tue, 13 Feb 2024, Philippe Mathieu-Daudé wrote: We should not wire IRQs on unrealized device. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: BALATON Zoltan --- hw/i386/pc_q35.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35

Re: [PATCH 4/9] hw/ide/ahci: Inline ahci_get_num_ports()

2024-02-13 Thread Richard Henderson
On 2/12/24 22:11, Philippe Mathieu-Daudé wrote: Introduce the 'ich9' variable and inline ahci_get_num_ports(). Signed-off-by: Philippe Mathieu-Daudé --- include/hw/ide/ahci.h | 1 - hw/i386/pc_q35.c | 6 -- hw/ide/ahci.c | 8 hw/mips/boston.c | 6 -- 4 f

Re: [PATCH 1/9] hw/i386/q35: Use DEVICE() cast macro with PCIDevice object

2024-02-13 Thread Richard Henderson
On 2/12/24 22:11, Philippe Mathieu-Daudé wrote: QDev API provides the DEVICE() macro to access the 'qdev' parent field of the PCIDevice structure. Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/pc_q35.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Richard Hender

Re: [PATCH 9/9] hw/ide/ahci: Move SysBus definitions to 'ahci-sysbus.h'

2024-02-13 Thread Leif Lindholm
On 2024-02-13 08:12, Philippe Mathieu-Daudé wrote: Keep "hw/ide/ahci.h" AHCI-generic. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/arm/allwinner-a10.h | 2 +- include/hw/arm/allwinner-r40.h | 2 +- include/hw/arm/xlnx-zynqmp.h | 2 +- include/hw/ide/ahci-sysbus.h | 35 ++

Re: [PATCH v3 5/7] pcie_sriov: Validate NumVFs

2024-02-13 Thread Akihiko Odaki
On 2024/02/13 19:59, Michael S. Tsirkin wrote: On Mon, Feb 12, 2024 at 07:20:33PM +0900, Akihiko Odaki wrote: The guest may write NumVFs greater than TotalVFs and that can lead to buffer overflow in VF implementations. Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization

Re: [PATCH v3 6/7] pcie_sriov: Reuse SR-IOV VF device instances

2024-02-13 Thread Akihiko Odaki
On 2024/02/13 17:51, Minwoo Im wrote: -Original Message- From: qemu-block-bounces+minwoo.im.dev=gmail@nongnu.org On Behalf Of Akihiko Odaki Sent: Monday, February 12, 2024 7:21 PM To: Philippe Mathieu-Daudé ; Michael S. Tsirkin ; Marcel Apfelbaum ; Alex Williamson ; Cédric Le Goater

Re: [PATCH v4 12/12] hw/sparc64/cpu: Initialize GPIO before realizing CPU devices

2024-02-13 Thread Damien Hedde
On 2/13/24 14:03, Philippe Mathieu-Daudé wrote: Inline cpu_create() in order to call qdev_init_gpio_in_named_with_opaque() before the CPU is realized. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Reviewed-by: Mark Cave-Ayland --- hw/sparc64/sparc64.c | 4 +++- 1 file

Re: [PATCH v4 04/12] hw/i386/q35: Realize LPC PCI function before accessing it

2024-02-13 Thread Damien Hedde
On 2/13/24 14:03, Philippe Mathieu-Daudé wrote: We should not wire IRQs on unrealized device. Signed-off-by: Philippe Mathieu-Daudé > --- hw/i386/pc_q35.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 7ca3f465e0..b7c69d

[PATCH v4 06/12] hw/misc/macio: Realize IDE controller before accessing it

2024-02-13 Thread Philippe Mathieu-Daudé
We should not wire IRQs on unrealized device. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Mark Cave-Ayland --- hw/misc/macio/macio.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index c9f22f8515..3f449f91c0 100

[PATCH v4 12/12] hw/sparc64/cpu: Initialize GPIO before realizing CPU devices

2024-02-13 Thread Philippe Mathieu-Daudé
Inline cpu_create() in order to call qdev_init_gpio_in_named_with_opaque() before the CPU is realized. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Reviewed-by: Mark Cave-Ayland --- hw/sparc64/sparc64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/

[PATCH v4 10/12] hw/sparc/leon3: Pass DeviceState opaque argument to leon3_set_pil_in()

2024-02-13 Thread Philippe Mathieu-Daudé
By passing a DeviceState context to a QDev IRQ handler, we can simplify and use qdev_init_gpio_in_named() instead of qdev_init_gpio_in_named_with_opaque(). Suggested-by: Mark Cave-Ayland Signed-off-by: Philippe Mathieu-Daudé --- hw/sparc/leon3.c | 10 -- 1 file changed, 4 insertions(+),

[PATCH v4 11/12] hw/sparc/leon3: Initialize GPIO before realizing CPU devices

2024-02-13 Thread Philippe Mathieu-Daudé
Inline cpu_create() in order to call qdev_init_gpio_in_named_with_opaque() before the CPU is realized. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Reviewed-by: Mark Cave-Ayland --- hw/sparc/leon3.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw

[PATCH v4 05/12] hw/ppc/prep: Realize ISA bridge before accessing it

2024-02-13 Thread Philippe Mathieu-Daudé
We should not wire IRQs on unrealized device. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Reviewed-by: Mark Cave-Ayland --- hw/ppc/prep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 1a6cd05c61..4eb5477069 100644 -

[PATCH v4 08/12] hw/sparc/sun4m: Realize DMA controller before accessing it

2024-02-13 Thread Philippe Mathieu-Daudé
We should not wire IRQs on unrealized device. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Reviewed-by: Mark Cave-Ayland --- hw/sparc/sun4m.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index e782c8ec7a..d52

[PATCH v4 09/12] hw/sparc/leon3: Realize GRLIB IRQ controller before accessing it

2024-02-13 Thread Philippe Mathieu-Daudé
We should not wire IRQs on unrealized device. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Reviewed-by: Mark Cave-Ayland --- hw/sparc/leon3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index 2dfb742566..0df5fc

[PATCH v4 07/12] hw/sh4/r2d: Realize IDE controller before accessing it

2024-02-13 Thread Philippe Mathieu-Daudé
We should not wire IRQs on unrealized device. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Reviewed-by: Yoshinori Sato --- hw/sh4/r2d.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index e9f316a6ce..c73e8f49b8 100644 --- a/

[PATCH v4 04/12] hw/i386/q35: Realize LPC PCI function before accessing it

2024-02-13 Thread Philippe Mathieu-Daudé
We should not wire IRQs on unrealized device. Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/pc_q35.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 7ca3f465e0..b7c69d55d6 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c

[PATCH v4 03/12] hw/rx/rx62n: Only call qdev_get_gpio_in() when necessary

2024-02-13 Thread Philippe Mathieu-Daudé
Instead of filling an array of all the possible IRQs, only call qdev_get_gpio_in() when an IRQ is used. Remove the array from RX62NState. Doing so we avoid calling qdev_get_gpio_in() on an unrealized device. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Reviewed-by: Yoshinori

[PATCH v4 02/12] hw/rx/rx62n: Reduce inclusion of 'qemu/units.h'

2024-02-13 Thread Philippe Mathieu-Daudé
"qemu/units.h" is not used in the "hw/rx/rx62n.h" header, include it in the source where it is. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Reviewed-by: Yoshinori Sato --- include/hw/rx/rx62n.h | 1 - hw/rx/rx-gdbsim.c | 1 + hw/rx/rx62n.c | 1 + 3 files change

[PATCH v4 01/12] hw/ide/ich9: Use AHCIPCIState typedef

2024-02-13 Thread Philippe Mathieu-Daudé
QEMU coding style recommend using structure typedefs: https://www.qemu.org/docs/master/devel/style.html#typedefs Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell --- hw/ide/ich.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/ide/ich.c b/hw/ide/ich.

[PATCH v4 00/12] hw: Strengthen SysBus & QBus API

2024-02-13 Thread Philippe Mathieu-Daudé
Missing review: 4, 12 Since v1: - Addressed Zoltan review comments - Addressed Mark suggestion - Added R-b tags Hi, This series ensure following is called *before* a device is realized: - qbus_new() - sysbus_init_mmio() - qdev_init_gpio_in_named_with_opaque() and these are called *after* it is:

Re: [PATCH v3 11/11] hw/sparc64/cpu: Initialize GPIO before realizing CPU devices

2024-02-13 Thread Philippe Mathieu-Daudé
On 9/2/24 23:01, Mark Cave-Ayland wrote: On 09/02/2024 11:34, Peter Maydell wrote: On Thu, 8 Feb 2024 at 18:14, Philippe Mathieu-Daudé wrote: Inline cpu_create() in order to call qdev_init_gpio_in_named_with_opaque() before the CPU is realized. Signed-off-by: Philippe Mathieu-Daudé ---   h

Re: [PATCH v3 6/7] pcie_sriov: Reuse SR-IOV VF device instances

2024-02-13 Thread Akihiko Odaki
On 2024/02/13 17:51, Minwoo Im wrote: -Original Message- From: qemu-block-bounces+minwoo.im.dev=gmail@nongnu.org On Behalf Of Akihiko Odaki Sent: Monday, February 12, 2024 7:21 PM To: Philippe Mathieu-Daudé ; Michael S. Tsirkin ; Marcel Apfelbaum ; Alex Williamson ; Cédric Le Goater

Re: [PATCH v3 6/7] pcie_sriov: Reuse SR-IOV VF device instances

2024-02-13 Thread Akihiko Odaki
On 2024/02/13 20:01, Michael S. Tsirkin wrote: On Mon, Feb 12, 2024 at 07:20:34PM +0900, Akihiko Odaki wrote: Disable SR-IOV VF devices by reusing code to power down PCI devices instead of removing them when the guest requests to disable VFs. This allows to realize devices and report VF realizat

Re: [PATCH v3 2/7] hw/pci: Determine if rombar is explicitly enabled

2024-02-13 Thread Akihiko Odaki
On 2024/02/13 19:52, Michael S. Tsirkin wrote: On Mon, Feb 12, 2024 at 07:20:30PM +0900, Akihiko Odaki wrote: vfio determines if rombar is explicitly enabled by inspecting QDict. Inspecting QDict is not nice because QDict is untyped and depends on the details on the external interface. Add an in

Re: [PATCH 0/9] hw/ide/ahci: Housekeeping

2024-02-13 Thread Michael S. Tsirkin
On Tue, Feb 13, 2024 at 09:11:51AM +0100, Philippe Mathieu-Daudé wrote: > - Split 'ahci.h' as sysbus / pci > - Inline ahci_get_num_ports() > - Directly use AHCIState::ports instead of SysbusAHCIState::num_ports PC part: Reviewed-by: Michael S. Tsirkin feel free to merge with rest of patches.

Re: [PATCH v3 6/7] pcie_sriov: Reuse SR-IOV VF device instances

2024-02-13 Thread Michael S. Tsirkin
On Mon, Feb 12, 2024 at 07:20:34PM +0900, Akihiko Odaki wrote: > Disable SR-IOV VF devices by reusing code to power down PCI devices > instead of removing them when the guest requests to disable VFs. This > allows to realize devices and report VF realization errors at PF > realization time. > > Si

Re: [PATCH v3 5/7] pcie_sriov: Validate NumVFs

2024-02-13 Thread Michael S. Tsirkin
On Mon, Feb 12, 2024 at 07:20:33PM +0900, Akihiko Odaki wrote: > The guest may write NumVFs greater than TotalVFs and that can lead > to buffer overflow in VF implementations. > > Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization > (SR/IOV)") > Signed-off-by: Akihiko Odak

Re: [PATCH v3 2/7] hw/pci: Determine if rombar is explicitly enabled

2024-02-13 Thread Michael S. Tsirkin
On Mon, Feb 12, 2024 at 07:20:30PM +0900, Akihiko Odaki wrote: > vfio determines if rombar is explicitly enabled by inspecting QDict. > Inspecting QDict is not nice because QDict is untyped and depends on the > details on the external interface. Add an infrastructure to determine if > rombar is exp

RE: [PATCH v3 6/7] pcie_sriov: Reuse SR-IOV VF device instances

2024-02-13 Thread Minwoo Im
> -Original Message- > From: qemu-block-bounces+minwoo.im.dev=gmail@nongnu.org bounces+minwoo.im.dev=gmail@nongnu.org> On Behalf Of Akihiko Odaki > Sent: Monday, February 12, 2024 7:21 PM > To: Philippe Mathieu-Daudé ; Michael S. Tsirkin > ; Marcel Apfelbaum ; Alex > Williamson ; C

[PATCH 4/9] hw/ide/ahci: Inline ahci_get_num_ports()

2024-02-13 Thread Philippe Mathieu-Daudé
Introduce the 'ich9' variable and inline ahci_get_num_ports(). Signed-off-by: Philippe Mathieu-Daudé --- include/hw/ide/ahci.h | 1 - hw/i386/pc_q35.c | 6 -- hw/ide/ahci.c | 8 hw/mips/boston.c | 6 -- 4 files changed, 8 insertions(+), 13 deletions(-) diff --

[PATCH 5/9] hw/ide/ahci: Pass AHCI context to ahci_ide_create_devs()

2024-02-13 Thread Philippe Mathieu-Daudé
Since ahci_ide_create_devs() is not PCI specific, pass it an AHCIState argument instead of PCIDevice. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/ide/ahci.h | 2 +- hw/i386/pc_q35.c | 2 +- hw/ide/ahci.c | 5 + hw/mips/boston.c | 2 +- 4 files changed, 4 insertions

[PATCH 1/9] hw/i386/q35: Use DEVICE() cast macro with PCIDevice object

2024-02-13 Thread Philippe Mathieu-Daudé
QDev API provides the DEVICE() macro to access the 'qdev' parent field of the PCIDevice structure. Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/pc_q35.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 7ca3f465e0..33a4413708 1

[PATCH 7/9] hw/ide/ahci: Do not pass 'ports' argument to ahci_realize()

2024-02-13 Thread Philippe Mathieu-Daudé
Explicitly set AHCIState::ports before calling ahci_realize(). Signed-off-by: Philippe Mathieu-Daudé --- hw/ide/ahci_internal.h | 2 +- hw/ide/ahci.c | 9 + hw/ide/ich.c | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/ide/ahci_internal.h b/hw

[PATCH 8/9] hw/ide/ahci: Remove SysbusAHCIState::num_ports field

2024-02-13 Thread Philippe Mathieu-Daudé
No need to duplicate AHCIState::ports, directly access it. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/ide/ahci.h | 1 - hw/ide/ahci.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/hw/ide/ahci.h b/include/hw/ide/ahci.h index 604d3a0994..c0b10c2bb

[PATCH 6/9] hw/ide/ahci: Convert AHCIState::ports to unsigned

2024-02-13 Thread Philippe Mathieu-Daudé
AHCIState::ports should be unsigned. Besides, we never check it for negative value. It is unlikely it was ever used with more than INT32_MAX ports, so it is safe to convert it to unsigned. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/ide/ahci.h | 2 +- hw/ide/ahci.c | 4 ++-- 2 f

[PATCH 3/9] hw/ide/ahci: Rename AHCI PCI function as 'pdev'

2024-02-13 Thread Philippe Mathieu-Daudé
We want to access AHCIPCIState::ahci field. In order to keep the code simple (avoiding &ahci->ahci), rename the current 'ahci' variable as 'pdev' Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/pc_q35.c | 15 --- hw/mips/boston.c | 10 +- 2 files changed, 13 insertions(+),

[PATCH 9/9] hw/ide/ahci: Move SysBus definitions to 'ahci-sysbus.h'

2024-02-13 Thread Philippe Mathieu-Daudé
Keep "hw/ide/ahci.h" AHCI-generic. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/arm/allwinner-a10.h | 2 +- include/hw/arm/allwinner-r40.h | 2 +- include/hw/arm/xlnx-zynqmp.h | 2 +- include/hw/ide/ahci-sysbus.h | 35 ++ include/hw/ide/ahci.h

[PATCH 0/9] hw/ide/ahci: Housekeeping

2024-02-13 Thread Philippe Mathieu-Daudé
- Split 'ahci.h' as sysbus / pci - Inline ahci_get_num_ports() - Directly use AHCIState::ports instead of SysbusAHCIState::num_ports Philippe Mathieu-Daudé (9): hw/i386/q35: Use DEVICE() cast macro with PCIDevice object hw/ide/ahci: Expose AHCIPCIState structure hw/ide/ahci: Rename AHCI PCI

[PATCH 2/9] hw/ide/ahci: Expose AHCIPCIState structure

2024-02-13 Thread Philippe Mathieu-Daudé
In order to be able to QOM-embed a structure, we need its full definition. Move it from "ahci_internal.h" to the new "hw/ide/ahci-pci.h" header. Signed-off-by: Philippe Mathieu-Daudé --- hw/ide/ahci_internal.h| 8 include/hw/ide/ahci-pci.h | 22 ++ include/hw/id