[PATCH] migration: Free argv

2024-02-24 Thread Akihiko Odaki
exec_start_outgoing_migration() and exec_start_incoming_migration() leak argv because it uses g_steal_pointer() is used to pass argv qio_channel_command_new_spawn() while it does not free argv either. Removing g_steal_pointer() is not sufficient though because argv is typed g_auto(GStrv), which me

[PATCH v2] target/riscv: Fix shift count overflow

2024-02-24 Thread demin.han
The result of (8 - 3 - vlmul) is negtive when vlmul >= 6, and results in wrong vill. Signed-off-by: demin.han --- target/riscv/vector_helper.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index 84cec73eb2..fe

Re: [External] Re: [PATCH v2 4/7] migration/multifd: Enable zero page checking from multifd threads.

2024-02-24 Thread Hao Xiang
On Thu, Feb 22, 2024 at 10:02 PM Hao Xiang wrote: > > On Thu, Feb 22, 2024 at 6:33 PM Peter Xu wrote: > > > > On Wed, Feb 21, 2024 at 06:06:19PM -0300, Fabiano Rosas wrote: > > > Hao Xiang writes: > > > > > > > This change adds a dedicated handler for > > > > MigrationOps::ram_save_target_page

Re: [External] Re: [PATCH v2 3/7] migration/multifd: Zero page transmission on the multifd thread.

2024-02-24 Thread Hao Xiang
On Thu, Feb 22, 2024 at 9:15 PM Hao Xiang wrote: > > On Thu, Feb 22, 2024 at 6:21 PM Peter Xu wrote: > > > > On Wed, Feb 21, 2024 at 06:04:10PM -0300, Fabiano Rosas wrote: > > > Hao Xiang writes: > > > > > > > 1. Implements the zero page detection and handling on the multifd > > > > threads for

Re: [PATCH 2/2] xen: fix stubdom PCI addr

2024-02-24 Thread Jason Andryuk
On Mon, Feb 19, 2024 at 1:49 PM Marek Marczykowski-Górecki wrote: > > From: Frédéric Pierret (fepitre) > > When running in a stubdomain, the config space access via sysfs needs to > use BDF as seen inside stubdomain (connected via xen-pcifront), which is > different from the real BDF. For other p

Re: [PATCH 05/10] hppa: do not require CONFIG_USB

2024-02-24 Thread Paolo Bonzini
On Fri, Feb 23, 2024 at 8:56 PM BALATON Zoltan wrote: > >> -if (!lasi_dev && machine->enable_graphics) { > >> +if (!lasi_dev && machine->enable_graphics && defaults_enabled()) { > > > > Do we need the defaults_enabled() here? Isn't enable_graphics already > > disabled if defaults_enabled()

Re: [PULL v2 00/39] tcg and linux-user patch queue

2024-02-24 Thread Richard Henderson
On 2/24/24 06:15, Peter Maydell wrote: Hi -- looks like this introduces an new variable-length-array, which we are trying to get rid of: ../linux-user/elfload.c: In function 'vma_dump_size': ../linux-user/elfload.c:4254:9: error: ISO C90 forbids variable length array 'page' [-Werror=vla] 4254 |

[PATCH v5 2/3] hw/arm: Connect BSC to BCM2835 board as I2C0, I2C1 and I2C2

2024-02-24 Thread Rayhan Faizel
BCM2835 has three I2C controllers. All of them share the same interrupt line. Signed-off-by: Rayhan Faizel --- hw/arm/Kconfig | 1 + hw/arm/bcm2835_peripherals.c | 45 ++-- include/hw/arm/bcm2835_peripherals.h | 4 ++- 3 files changed, 46 i

[PATCH v5 1/3] hw/i2c: Implement Broadcom Serial Controller (BSC)

2024-02-24 Thread Rayhan Faizel
A few deficiencies in the current device model need to be noted. 1. FIFOs are not used. All sends and receives are done directly. 2. Repeated starts are not emulated. Repeated starts can be triggered in real hardware by sending a new read transfer request in the window time between transfer active

[PATCH v5 0/3] Add support for I2C in BCM2835 boards

2024-02-24 Thread Rayhan Faizel
This patch series implements support for the Broadcom Serial Controller used by BCM2835 based boards for I2C. [Changes in v5] - Improper whitespace again. [Changes in v4] - Added IRQ or-gate for common BSC IRQ. - Added valid sizes to MemoryRegionOps. - Use version tag instead of master [Change

[PATCH v5 3/3] tests/qtest: Add testcase for BCM2835 BSC

2024-02-24 Thread Rayhan Faizel
Simple testcase for validating proper operation of read and write for all three BSC controllers. Signed-off-by: Rayhan Faizel Reviewed-by: Peter Maydell --- tests/qtest/bcm2835-i2c-test.c | 115 + tests/qtest/meson.build| 2 +- 2 files changed, 116 inse

[PATCH v4 0/3] Add support for I2C in BCM2835 boards

2024-02-24 Thread Rayhan Faizel
This patch series implements support for the Broadcom Serial Controller used by BCM2835 based boards for I2C. [Changes in v4] - Added IRQ or-gate for common BSC IRQ. - Added valid sizes to MemoryRegionOps. - Use version tag instead of master [Changes in v3] - Add SPDX license identifiers. - Fix

[PATCH v4 1/3] hw/i2c: Implement Broadcom Serial Controller (BSC)

2024-02-24 Thread Rayhan Faizel
A few deficiencies in the current device model need to be noted. 1. FIFOs are not used. All sends and receives are done directly. 2. Repeated starts are not emulated. Repeated starts can be triggered in real hardware by sending a new read transfer request in the window time between transfer active

[PATCH v4 2/3] hw/arm: Connect BSC to BCM2835 board as I2C0, I2C1 and I2C2

2024-02-24 Thread Rayhan Faizel
BCM2835 has three I2C controllers. All of them share the same interrupt line. Signed-off-by: Rayhan Faizel --- hw/arm/Kconfig | 1 + hw/arm/bcm2835_peripherals.c | 45 ++-- include/hw/arm/bcm2835_peripherals.h | 4 ++- 3 files changed, 46 i

[PATCH v4 3/3] tests/qtest: Add testcase for BCM2835 BSC

2024-02-24 Thread Rayhan Faizel
Simple testcase for validating proper operation of read and write for all three BSC controllers. Signed-off-by: Rayhan Faizel Reviewed-by: Peter Maydell --- tests/qtest/bcm2835-i2c-test.c | 115 + tests/qtest/meson.build| 2 +- 2 files changed, 116 inse

Re: [External] Re: [PATCH v2 3/7] migration/multifd: Zero page transmission on the multifd thread.

2024-02-24 Thread Hao Xiang
On Thu, Feb 22, 2024 at 8:38 PM Hao Xiang wrote: > > On Fri, Feb 16, 2024 at 9:08 PM Richard Henderson > wrote: > > > > On 2/16/24 12:39, Hao Xiang wrote: > > > +void multifd_zero_page_check_recv(MultiFDRecvParams *p) > > > +{ > > > +for (int i = 0; i < p->zero_num; i++) { > > > +void

[Bug 2054889] Re: pcap streams are text files which insert 0xD in Windows version

2024-02-24 Thread Stefan Weil
** Changed in: qemu Status: New => Confirmed -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/2054889 Title: pcap streams are text files which insert 0xD in Windows version Status in QEMU: C

[Bug 2054889] [NEW] pcap streams are text files which insert 0xD in Windows version

2024-02-24 Thread Benjamin David Lunt
Public bug reported: Since Windows text files use CRLFs for all \n, the Windows version of QEMU inserts a CR in the PCAP stream when a LF is encountered when using USB PCAP files. Starting at line 275 in hw/usb/bus (https://gitlab.com/qemu- project/qemu/-/blob/master/hw/usb/bus.c?ref_type=heads#L

Re: [PATCH] target/riscv: Fix shift count overflow

2024-02-24 Thread Daniel Henrique Barboza
On 2/24/24 10:02, demin.han wrote: The result of (8 - 3 - vlmul) is negtive when vlmul >= 6, and results in wrong vill. Signed-off-by: demin.han --- target/riscv/vector_helper.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/riscv/vector_helper.c b/target/ris

Re: [PATCH] scripts/qemu-binfmt-conf.sh: refresh

2024-02-24 Thread Michael Tokarev
23.02.2024 18:55, Peter Maydell: On Sun, 18 Feb 2024 at 09:32, Michael Tokarev wrote: 09.09.2023 16:23, Michael Tokarev : A friendly ping? A friendly ping #2? Looking at the patch, the commit message lists 9 separate things it does. That suggests it ought to be a 9-patch patchset, not a s

Re: [PULL v2 00/39] tcg and linux-user patch queue

2024-02-24 Thread Peter Maydell
On Sat, 24 Feb 2024 at 01:06, Richard Henderson wrote: > > v2: Fix bsd-user build errors. > > > r~ > > > The following changes since commit 3d54cbf269d63ff1d500b35b2bcf4565ff8ad485: > > Merge tag 'hw-misc-20240222' of https://github.com/philmd/qemu into staging > (2024-02-22 15:44:29 +) > >

Re: [PATCH v2 1/3] qtest: migration: Enhance qtest migration functions to support 'channels' argument

2024-02-24 Thread Het Gala
On 24/02/24 6:18 pm, Het Gala wrote: On 24/02/24 1:42 am, Fabiano Rosas wrote: Het Gala writes: Introduce support for adding a 'channels' argument to migrate_qmp_fail, migrate_incoming_qmp and migrate_qmp functions within the migration qtest framework, enabling enhanced control over migrat

[PATCH RFC 0/3] Support GM/T 0018-2012 cryptographic standard

2024-02-24 Thread Hyman Huang
This patchset introduce GM/T 0018-2012 as a crypto backend driver, which is applied for block encryption. Currently, we support SM4 cipher algorithm only. GM/T 0018-2012 is a cryptographic standard issued by the State Cryptography Administration of China. Visit https://hbba.sacinfo.org.cn search G

[PATCH RFC 1/3] crypto: Introduce GM/T 0018-2012 cryptographic driver

2024-02-24 Thread Hyman Huang
GM/T 0018-2012 is a cryptographic standard issued by the State Cryptography Administration of China. For more information about the standard, visit https://hbba.sacinfo.org.cn. The objective of the standard is to develop a uniform application interface standard for the service-based cryptography d

[PATCH RFC 3/3] crypto: Allow GM/T 0018-2012 to support SM4 cipher algorithm

2024-02-24 Thread Hyman Huang
Since GM/T 0018-2012 was probed by SM4 cipher algorithm, allow it to support SM4 cipher algorithm in block encryption. Signed-off-by: Hyman Huang --- crypto/block-luks.c | 4 ++-- crypto/cipher.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crypto/block-luks.c b/c

[PATCH RFC 2/3] meson.build: Support GM/T 0018-2012 cryptographic standard

2024-02-24 Thread Hyman Huang
GM/T 0018-2012 is a cryptographic standard issued by the State Cryptography Administration of China. The implement of the standard could support symmetric cipher algorithm for block encryption. SM4 cipher algorithms could be applied currently, so detect SM4 cipher algorithms via GM/T 0018-2012 API

[PATCH] target/riscv: Fix shift count overflow

2024-02-24 Thread demin.han
The result of (8 - 3 - vlmul) is negtive when vlmul >= 6, and results in wrong vill. Signed-off-by: demin.han --- target/riscv/vector_helper.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index 84cec73eb2..ced0a

Re: [PATCH v2] ui/cocoa: Fix window clipping on macOS 14

2024-02-24 Thread Akihiko Odaki
On 2024/02/24 23:06, David Parsons wrote: macOS Sonoma changes the NSView.clipsToBounds to false by default where it was true in earlier version of macOS. This causes the window contents to be occluded by the frame at the top of the window. This fixes the issue by conditionally compiling the clip

Re: [PATCH v2 0/6] Simplify initialization of PC machines

2024-02-24 Thread Bernhard Beschow
Am 24. Februar 2024 13:58:45 UTC schrieb Bernhard Beschow : >The series aims to simplify the initialization process of all PC-based machines > >by streamlining redundant code. > > > >Since I haven't seen patches on the list so far for folding CMOS data > >generation into pc.c, which frees all PC

[PATCH v2] ui/cocoa: Fix window clipping on macOS 14

2024-02-24 Thread David Parsons
macOS Sonoma changes the NSView.clipsToBounds to false by default where it was true in earlier version of macOS. This causes the window contents to be occluded by the frame at the top of the window. This fixes the issue by conditionally compiling the clipping on Sonoma to true. NSView only exposes

Re: [PATCH 0/9] Simplify initialization of PC machines

2024-02-24 Thread Bernhard Beschow
Am 22. Februar 2024 15:25:01 UTC schrieb "Michael S. Tsirkin" : >On Thu, Feb 08, 2024 at 11:03:40PM +0100, Bernhard Beschow wrote: >> The series aims to simplify the initialization process of all PC-based >> machines. >> >> It consists of streamlining redundant code, as well as consolidating t

[PATCH v2 3/6] hw/i386/pc_{piix, q35}: Eliminate local pci_bus/pci_host variables

2024-02-24 Thread Bernhard Beschow
There is no advantage in having these local variables which 1/ needlessly have different identifiers in both machines and 2/ which are redundant to pcms->bus which is almost as short. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin --- hw/i386/pc_piix.c | 14 ++ hw/i

[PATCH v2 5/6] hw/i386/pc: Populate RTC attribute directly

2024-02-24 Thread Bernhard Beschow
Both the piix and the q35 machines introduce an rtc_state variable and defer the initialization of the X86MachineState::rtc attribute to pc_cmos_init(). Resolve this complication which makes pc_cmos_init() do what it says on the tin. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin

[PATCH v2 1/6] hw/i386/x86: Let ioapic_init_gsi() take parent as pointer

2024-02-24 Thread Bernhard Beschow
Rather than taking a QOM name which has to be resolved, let's pass the parent directly as pointer. This simplifies the code. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin --- include/hw/i386/x86.h | 2 +- hw/i386/microvm.c | 2 +- hw/i386/pc_piix.c | 7 +++ hw/i386

[PATCH v2 0/6] Simplify initialization of PC machines

2024-02-24 Thread Bernhard Beschow
The series aims to simplify the initialization process of all PC-based machines by streamlining redundant code. Since I haven't seen patches on the list so far for folding CMOS data generation into pc.c, which frees all PC machines from performing this duty explicitly, I've appended this cleanup a

[PATCH v2 6/6] hw/i386/pc: Inline pc_cmos_init() into pc_cmos_init_late() and remove it

2024-02-24 Thread Bernhard Beschow
Now that pc_cmos_init() doesn't populate the X86MachineState::rtc attribute any longer, its duties can be merged into pc_cmos_init_late() which is called within machine_done notifier. This frees pc_piix and pc_q35 from explicit CMOS initialization. Signed-off-by: Bernhard Beschow --- include/hw/

[PATCH v2 4/6] hw/i386/pc: Remove unneeded class attribute "kvmclock_enabled"

2024-02-24 Thread Bernhard Beschow
PCMachineClass introduces the attribute into the class hierarchy and sets it to true. There is no sub class overriding the attribute. Commit 30d2a17b46e9 "hw/i386: Remove the deprecated machines 0.12 up to 0.15" removed the last overrides of this attribute. The attribute is now unneeded and can be

[PATCH v2 2/6] hw/i386/pc: Rename "bus" attribute to "pcibus"

2024-02-24 Thread Bernhard Beschow
The attribute is of type PCIBus; reflect that in the name. It will also make the next change more intuitive. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Bernhard Beschow --- include/hw/i386/pc.h | 2 +- hw/i386/acpi-build.c | 2 +- hw/i386/amd_iommu.c | 2 +- hw/i386/intel_

Re: [PATCH] hw/nvme: fix invalid endian conversion

2024-02-24 Thread Minwoo Im
On 24-02-22 10:29:06, Klaus Jensen wrote: > From: Klaus Jensen > > numcntl is one byte and so is max_vfs. Using cpu_to_le16 on big endian > hosts results in numcntl being set to 0. > > Fix by dropping the endian conversion. > > Fixes: 746d42b13368 ("hw/nvme: Initialize capability structures for

Re: [PATCH v11 6/6] ui/cocoa: Remove stretch_video flag

2024-02-24 Thread BALATON Zoltan
On Sat, 24 Feb 2024, Akihiko Odaki wrote: On 2024/02/23 1:53, Peter Maydell wrote: On Sat, 17 Feb 2024 at 11:19, Akihiko Odaki wrote: Evaluate [normalWindow styleMask] & NSWindowStyleMaskResizable instead. Signed-off-by: Akihiko Odaki --- ui/cocoa.m | 11 --- 1 file changed, 4 in

Re: [PATCH v11 6/6] ui/cocoa: Remove stretch_video flag

2024-02-24 Thread Akihiko Odaki
On 2024/02/23 1:53, Peter Maydell wrote: On Sat, 17 Feb 2024 at 11:19, Akihiko Odaki wrote: Evaluate [normalWindow styleMask] & NSWindowStyleMaskResizable instead. Signed-off-by: Akihiko Odaki --- ui/cocoa.m | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/u

Re: [PATCH v11 3/6] ui/cocoa: Let the platform toggle fullscreen

2024-02-24 Thread Akihiko Odaki
On 2024/02/23 1:56, Peter Maydell wrote: On Sat, 17 Feb 2024 at 11:19, Akihiko Odaki wrote: It allows making the window full screen by clicking full screen button provided by the platform (the left-top green button) and save some code. Signed-off-by: Akihiko Odaki --- ui/cocoa.m | 423

Re: [PATCH v2 1/3] qtest: migration: Enhance qtest migration functions to support 'channels' argument

2024-02-24 Thread Het Gala
On 24/02/24 1:42 am, Fabiano Rosas wrote: Het Gala writes: Introduce support for adding a 'channels' argument to migrate_qmp_fail, migrate_incoming_qmp and migrate_qmp functions within the migration qtest framework, enabling enhanced control over migration scenarios. Can't we just pass a cha

[PATCH v12 08/10] ui/cocoa: Make window resizable

2024-02-24 Thread Akihiko Odaki
The window will be resizable when zoom-to-fit is on. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- ui/cocoa.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/cocoa.m b/ui/cocoa.m index 05c91e4eed53..cebfae04d9e8 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1348,8 +1348,1

[PATCH v12 06/10] ui/cocoa: Let the platform toggle fullscreen

2024-02-24 Thread Akihiko Odaki
It allows making the window full screen by clicking full screen button provided by the platform (the left-top green button) and save some code. Signed-off-by: Akihiko Odaki --- ui/cocoa.m | 408 +++-- 1 file changed, 181 insertions(+), 227

[PATCH v12 01/10] ui/cocoa: Split [-QemuCocoaView handleEventLocked:]

2024-02-24 Thread Akihiko Odaki
Currently [-QemuCocoaView handleEventLocked:] parses the passed event, stores operations to be done to variables, and perform them according to the variables. This construct will be cluttered with variables and hard to read when we need more different operations for different events. Split the met

[PATCH v12 07/10] ui/cocoa: Remove normalWindow

2024-02-24 Thread Akihiko Odaki
QemuCocoaView used to have fullScreenWindow but now it's gone, so we do no longer have to call the window specifically "normalWindow". Instead, refer to it with [-QemuCocoaView window]. Signed-off-by: Akihiko Odaki --- ui/cocoa.m | 33 + 1 file changed, 17 inserti

[PATCH v12 05/10] ui/cocoa: Fix pause label coordinates

2024-02-24 Thread Akihiko Odaki
A subview is positioned in the superview so the superview's frame should be used instead of one of the window to determine the coordinates. Signed-off-by: Akihiko Odaki --- ui/cocoa.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 644fd32eaa

Re: [PULL 00/47] ppc-for-9.0 queue

2024-02-24 Thread Peter Maydell
ilable in the Git repository at: > > https://gitlab.com/npiggin/qemu.git tags/pull-ppc-for-9.0-20240224 > > for you to fetch changes up to 4acc505d2236190efea94746e7f22e2c07bce5d6: > > target/ppc: optimise ppcemb_tlb_t flushing (2024-02-23 23:24:43 +1000) > > -

[PATCH v12 04/10] ui/cocoa: Scale with NSView instead of Core Graphics

2024-02-24 Thread Akihiko Odaki
Core Graphics is not accelerated and slow. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- ui/cocoa.m | 24 ++-- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index c73ef8884454..644fd32eaa4d 100644 --- a/ui/cocoa.m +++ b

[PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize

2024-02-24 Thread Akihiko Odaki
V5 -> V6: Rebased. Signed-off-by: Akihiko Odaki --- Changes in v12: - Extracted patches "ui/cocoa: Split [-QemuCocoaView handleEventLocked:]", "ui/cocoa: Immediately call [-QemuCocoaView handleMouseEvent:buttons:]" from "ui/cocoa: Release specific mouse buttons". (Peter Maydell) - Changed t

[PATCH v12 10/10] ui/cocoa: Remove stretch_video flag

2024-02-24 Thread Akihiko Odaki
Evaluate [normalWindow styleMask] & NSWindowStyleMaskResizable instead. Signed-off-by: Akihiko Odaki --- ui/cocoa.m | 19 ++- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 33d31b82bcab..b33842e70280 100644 --- a/ui/cocoa.m +++ b/ui/c

[PATCH v12 02/10] ui/cocoa: Immediately call [-QemuCocoaView handleMouseEvent:buttons:]

2024-02-24 Thread Akihiko Odaki
Instead of using mouse_event variable to tell to handle a mouse event later, immediately call [-QemuCocoaView handleMouseEvent:buttons:]. Signed-off-by: Akihiko Odaki --- ui/cocoa.m | 87 ++ 1 file changed, 30 insertions(+), 57 deletion

[PATCH v12 09/10] ui/cocoa: Call console_select() with the BQL

2024-02-24 Thread Akihiko Odaki
[-QemuCocoaView displayConsole:] can be called anytime so explicitly take the BQL before it calls console_select(). Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- ui/cocoa.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index cebfae0

[PATCH v12 03/10] ui/cocoa: Release specific mouse buttons

2024-02-24 Thread Akihiko Odaki
ui/cocoa used to release all mouse buttons when it sees NSEventTypeLeftMouseUp, NSEventTypeRightMouseUp, or NSEventTypeOtherMouseUp, but it can instead release specific one according to the delivered event. Signed-off-by: Akihiko Odaki --- ui/cocoa.m | 36 +++- 1

[PATCH v6 1/3] hw/gpio: Implement STM32L4x5 GPIO

2024-02-24 Thread Inès Varhol
Features supported : - the 8 STM32L4x5 GPIOs are initialized with their reset values (except IDR, see below) - input mode : setting a pin in input mode "externally" (using input irqs) results in an out irq (transmitted to SYSCFG) - output mode : setting a bit in ODR sets the corresponding o

[PATCH v6 2/3] hw/arm: Connect STM32L4x5 GPIO to STM32L4x5 SoC

2024-02-24 Thread Inès Varhol
Signed-off-by: Arnaud Minier Signed-off-by: Inès Varhol Reviewed-by: Philippe Mathieu-Daudé --- include/hw/arm/stm32l4x5_soc.h | 2 + include/hw/gpio/stm32l4x5_gpio.h | 1 + include/hw/misc/stm32l4x5_syscfg.h | 3 +- hw/arm/stm32l4x5_soc.c | 71 +++--

[PATCH v6 0/3] Add device STM32L4x5 GPIO

2024-02-24 Thread Inès Varhol
This patch adds a new device STM32L4x5 GPIO device and is part of a series implementing the STM32L4x5 with a few peripherals. Changes from v5 : - remove duplicate macro constant `GPIO_NUM_PINS` from syscfg.h (it's defined in gpio.h) - moving definition of constant `NUM_GPIOS` from syscfg.h to gpio

[PATCH v6 3/3] tests/qtest: Add STM32L4x5 GPIO QTest testcase

2024-02-24 Thread Inès Varhol
The testcase contains : - `test_idr_reset_value()` : Checks the reset values of MODER, OTYPER, PUPDR, ODR and IDR. - `test_gpio_output_mode()` : Checks that writing a bit in register ODR results in the corresponding pin rising or lowering, if this pin is configured in output mode. - `test_gpio_inpu

[PATCH v7 06/16] hw/pci: Rename has_power to enabled

2024-02-24 Thread Akihiko Odaki
The renamed state will not only represent powering state of PFs, but also represent SR-IOV VF enablement in the future. Signed-off-by: Akihiko Odaki --- include/hw/pci/pci.h| 7 ++- include/hw/pci/pci_device.h | 2 +- hw/pci/pci.c| 14 +++--- hw/pci/pci_host

[PATCH v7 07/16] pcie_sriov: Do not manually unrealize

2024-02-24 Thread Akihiko Odaki
A device gets automatically unrealized when being unparented. Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 5 - 1 file changed, 5 deletions(-) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index e9b23221d713..8b1fd2a89ad7 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie

[PATCH v7 10/16] pcie_sriov: Remove num_vfs from PCIESriovPF

2024-02-24 Thread Akihiko Odaki
num_vfs is not migrated so use PCI_SRIOV_CTRL_VFE and PCI_SRIOV_NUM_VF instead. Signed-off-by: Akihiko Odaki --- include/hw/pci/pcie_sriov.h | 1 - hw/pci/pcie_sriov.c | 28 hw/pci/trace-events | 2 +- 3 files changed, 21 insertions(+), 10 deletions

[PATCH v7 13/16] hw/pci: Use UINT32_MAX as a default value for rombar

2024-02-24 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 UINT32_MAX by default to distinguish these cases just as it is done for addr and romsize. It was confirmed that changing the default value to UINT32_MAX

[PATCH v7 05/16] hw/pci: Always call pcie_sriov_pf_reset()

2024-02-24 Thread Akihiko Odaki
Call pcie_sriov_pf_reset() from pci_do_device_reset() just as we do for msi_reset() and msix_reset() to prevent duplicating code for each SR-IOV PF. Signed-off-by: Akihiko Odaki --- hw/net/igb.c | 2 -- hw/nvme/ctrl.c | 4 hw/pci/pci.c | 1 + 3 files changed, 1 insertion(+), 6 deletions

[PATCH v7 09/16] pcie_sriov: Release VFs failed to realize

2024-02-24 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 v7 11/16] pcie_sriov: Register VFs after migration

2024-02-24 Thread Akihiko Odaki
pcie_sriov doesn't have code to restore its state after migration, but igb, which uses pcie_sriov, naively claimed its migration capability. Add code to register VFs after migration and fix igb migration. Fixes: 3a977deebe6b ("Intrdocue igb device emulation") Signed-off-by: Akihiko Odaki --- in

[PATCH v7 08/16] pcie_sriov: Reuse SR-IOV VF device instances

2024-02-24 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 v7 15/16] vfio: Avoid inspecting option QDict for rombar

2024-02-24 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 v7 04/16] pcie_sriov: Do not reset NumVFs after disabling VFs

2024-02-24 Thread Akihiko Odaki
The spec does not NumVFs is reset after disabling VFs except when resetting the PF. Clearing it is guest visible and out of spec, even though Linux doesn't rely on this value being preserved, so we never noticed. Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization (SR/IOV)"

[PATCH v7 02/16] pcie_sriov: Validate NumVFs

2024-02-24 Thread Akihiko Odaki
The guest may write NumVFs greater than TotalVFs and that can lead to buffer overflow in VF implementations. Cc: qemu-sta...@nongnu.org Fixes: CVE-2024-26327 Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization (SR/IOV)") Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.

[PATCH v7 12/16] hw/pci: Replace -1 with UINT32_MAX for romsize

2024-02-24 Thread Akihiko Odaki
romsize is an uint32_t variable. Specifying -1 as an uint32_t value is obscure way to denote UINT32_MAX. Worse, if int is wider than 32-bit, it will change the behavior of a construct like the following: romsize = -1; if (romsize != -1) { ... } When -1 is assigned to romsize, -1 will be impli

[PATCH v7 16/16] hw/qdev: Remove opts member

2024-02-24 Thread Akihiko Odaki
It is no longer used. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster --- 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/i

[PATCH v7 00/16] hw/pci: SR-IOV related fixes and improvements

2024-02-24 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. [1]: https://patche

[PATCH v7 14/16] hw/pci: Determine if rombar is explicitly enabled

2024-02-24 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 v7 03/16] pcie_sriov: Reset SR-IOV extended capability

2024-02-24 Thread Akihiko Odaki
pcie_sriov_pf_disable_vfs() is called when resetting the PF, but it only disables VFs and does not reset SR-IOV extended capability, leaking the state and making the VF Enable register inconsistent with the actual state. Replace pcie_sriov_pf_disable_vfs() with pcie_sriov_pf_reset(), which does no

[PATCH v7 01/16] hw/nvme: Use pcie_sriov_num_vfs()

2024-02-24 Thread Akihiko Odaki
nvme_sriov_pre_write_ctrl() used to directly inspect SR-IOV configurations to know the number of VFs being disabled due to SR-IOV configuration writes, but the logic was flawed and resulted in out-of-bound memory access. It assumed PCI_SRIOV_NUM_VF always has the number of currently enabled VFs, b

Re: [PATCH v2 21/27] plugins: add an API to read registers

2024-02-24 Thread Akihiko Odaki
On 2024/02/24 1:21, Alex Bennée wrote: We can only request a list of registers once the vCPU has been initialised so the user needs to use either call the get function on vCPU initialisation or during the translation phase. We don't expose the reg number to the plugin instead hiding it behind an