Re: [PATCH v4 3/5] hw/nvram/eeprom_at24c: Add init_rom field and at24c_eeprom_init_rom helper

2023-01-26 Thread Cédric Le Goater
I2CSlave *at24c_eeprom_init(I2CBus *bus, uint8_t address, uint32_t rom_size) { -I2CSlave *i2c_dev = i2c_slave_new(TYPE_AT24C_EE, address); -DeviceState *dev = DEVICE(i2c_dev); +return at24c_eeprom_init_rom(bus, address, rom_size, NULL, 0); +} + +I2CSlave

Re: no more pullreq processing til February

2023-01-26 Thread Thomas Huth
On 26/01/2023 15.28, Peter Maydell wrote: On Thu, 26 Jan 2023 at 14:25, Stefan Hajnoczi wrote: Are you batching pull requests? I used that approach last release cycle. CI takes so long to run that I didn't want to run it for every pull request. Batching worked well overall. No, I just do

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

2023-01-26 Thread Howard Spoelstra
On Fri, Jan 27, 2023 at 3:29 AM BALATON Zoltan wrote: > On Fri, 27 Jan 2023, BALATON Zoltan wrote: > > On Thu, 26 Jan 2023, Howard Spoelstra wrote: > >> On Thu, Jan 26, 2023 at 9:57 PM BALATON Zoltan > wrote: > >>> On Thu, 26 Jan 2023, Howard Spoelstra wrote: > Mac OS X > #10.0 bus1

Re: [PATCH v5 17/36] tcg: Split out tcg_gen_nonatomic_cmpxchg_i{32,64}

2023-01-26 Thread Richard Henderson
On 1/26/23 14:53, Philippe Mathieu-Daudé wrote: On 26/1/23 05:38, Richard Henderson wrote: Normally this is automatically handled by the CF_PARALLEL checks with in tcg_gen_atomic_cmpxchg_i{32,64}, but x86 has a special case of !PREFIX_LOCK where it always wants the non-atomic version. Split

Re: [PATCH v5 16/36] tcg: Add tcg_gen_{non}atomic_cmpxchg_i128

2023-01-26 Thread Richard Henderson
On 1/26/23 14:45, Philippe Mathieu-Daudé wrote: +    /* Compare i128 */ +    tcg_gen_xor_i64(t0, TCGV128_LOW(oldv), TCGV128_LOW(cmpv)); +    tcg_gen_xor_i64(t1, TCGV128_HIGH(oldv), TCGV128_HIGH(cmpv)); +    tcg_gen_or_i64(t0, t0, t1); Can we skip the OR ... +    /* tmpv =

[PATCH] microvm: update outdated docs

2023-01-26 Thread Gerd Hoffmann
Cc: Sergio Lopez Suggested-by: Stefan Hajnoczi Signed-off-by: Gerd Hoffmann --- docs/system/i386/microvm.rst | 52 +--- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/docs/system/i386/microvm.rst b/docs/system/i386/microvm.rst index

Re: [RFC] 2-stage translation emulation support for SMMUv3 on TCG

2023-01-26 Thread Richard Henderson
On 1/16/23 05:37, Evgeny Iakovlev wrote: Hi! We are using qemu-tcg-aarch64 to run Hyper-V test and debug builds for arm. Besides some minor fixes that i have submitted over the last couple of weeks, one big compatibility item for us is SMMUv3 2-stage translations support. We can do fine

[PATCH] hw/xen/xen_pt: fix uninitialized variable

2023-01-26 Thread Marek Marczykowski-Górecki
xen_pt_config_reg_init() reads only that many bytes as the size of the register that is being initialized. It uses xen_host_pci_get_{byte,word,long} and casts its last argument to expected pointer type. This means for smaller registers higher bits of 'val' are not initialized. Then, the function

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

2023-01-26 Thread BALATON Zoltan
On Fri, 27 Jan 2023, BALATON Zoltan wrote: On Thu, 26 Jan 2023, Howard Spoelstra wrote: On Thu, Jan 26, 2023 at 9:57 PM BALATON Zoltan wrote: On Thu, 26 Jan 2023, Howard Spoelstra wrote: Mac OS X #10.0 bus1 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to adb mouse. No recognition as

Re: [PATCH] hw/cxl: Add QTG _DSM support for ACPI0017 device

2023-01-26 Thread Dave Jiang
On 1/26/23 11:24 AM, Jonathan Cameron wrote: On Thu, 26 Jan 2023 11:07:37 -0700 Dave Jiang wrote: Hi Dave, That was quick! Add a simple _DSM call support for the ACPI0017 device to return a fake QTG ID value. Given the current CXL implementation does not involve switches, I don't

Re: [PATCH] hw/cxl: Add QTG _DSM support for ACPI0017 device

2023-01-26 Thread Dave Jiang
On 1/26/23 11:24 AM, Jonathan Cameron wrote: On Thu, 26 Jan 2023 11:07:37 -0700 Dave Jiang wrote: Hi Dave, That was quick! Add a simple _DSM call support for the ACPI0017 device to return a fake QTG ID value. Given the current CXL implementation does not involve switches, I don't

[PATCH] hw/cxl: Add QTG _DSM support for ACPI0017 device

2023-01-26 Thread Dave Jiang
Add a simple _DSM call support for the ACPI0017 device to return a fake QTG ID value. Given the current CXL implementation does not involve switches, a faked value of 0 can be returned for the QTG ID. The enabling is for _DSM plumbing testing from the OS. Signed-off-by: Dave Jiang ---

Re: [PATCH] hw/cxl: Add QTG _DSM support for ACPI0017 device

2023-01-26 Thread Dave Jiang
On 1/26/23 11:47 AM, Jonathan Cameron wrote: On Thu, 26 Jan 2023 11:41:47 -0700 Dave Jiang wrote: On 1/26/23 11:24 AM, Jonathan Cameron wrote: On Thu, 26 Jan 2023 11:07:37 -0700 Dave Jiang wrote: Hi Dave, That was quick! Add a simple _DSM call support for the ACPI0017 device to

Re: [PATCH v5 24/36] target/s390x: Use a single return for helper_divs32/u32

2023-01-26 Thread Philippe Mathieu-Daudé
On 26/1/23 05:38, Richard Henderson wrote: Pack the quotient and remainder into a single uint64_t. Signed-off-by: Richard Henderson --- v2: Fix operand ordering; use tcg_extr32_i64. Cc: David Hildenbrand Cc: Ilya Leoshkevich --- target/s390x/helper.h | 2 +-

Re: [PATCH v5 17/36] tcg: Split out tcg_gen_nonatomic_cmpxchg_i{32,64}

2023-01-26 Thread Philippe Mathieu-Daudé
On 26/1/23 05:38, Richard Henderson wrote: Normally this is automatically handled by the CF_PARALLEL checks with in tcg_gen_atomic_cmpxchg_i{32,64}, but x86 has a special case of !PREFIX_LOCK where it always wants the non-atomic version. Split these out so that x86 does not have to roll its

Re: [PATCH v5 16/36] tcg: Add tcg_gen_{non}atomic_cmpxchg_i128

2023-01-26 Thread Philippe Mathieu-Daudé
On 26/1/23 05:38, Richard Henderson wrote: This will allow targets to avoid rolling their own. Signed-off-by: Richard Henderson --- accel/tcg/tcg-runtime.h | 11 + include/tcg/tcg-op.h | 5 +++ tcg/tcg-op.c | 85 +++

Re: [PATCH] target/arm: Fix physical address resolution for Stage2

2023-01-26 Thread Philippe Mathieu-Daudé
On 27/1/23 00:31, Richard Henderson wrote: Conversion to probe_access_full missed applying the page offset. Cc: qemu-sta...@nongnu.org Reported-by: Sid Manning Fixes: f3639a64f602 ("target/arm: Use softmmu tlbs for page table walking") Signed-off-by: Richard Henderson --- target/arm/ptw.c |

Re: [PATCH v2 08/10] hw/ide: Let ide_init_ioport() take a MemoryRegion argument instead of ISADevice

2023-01-26 Thread Philippe Mathieu-Daudé
On 26/1/23 22:17, Bernhard Beschow wrote: Both callers to ide_init_ioport() have access to the I/O memory region of the ISA bus, so can pass it directly. This allows ide_init_ioport() to directly call portio_list_init(). Note, now the callers become the owner of the PortioList. Inspired-by:

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

2023-01-26 Thread BALATON Zoltan
On Thu, 26 Jan 2023, Howard Spoelstra wrote: On Thu, Jan 26, 2023 at 9:57 PM BALATON Zoltan wrote: On Thu, 26 Jan 2023, Howard Spoelstra wrote: Mac OS X #10.0 bus1 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to adb mouse. No recognition as HID device. #10.0 bus2 kbd: usb_ohci_stop

Re: [PATCH 01/18] vfio/migration: Add VFIO migration pre-copy support

2023-01-26 Thread Alex Williamson
On Thu, 26 Jan 2023 20:49:31 +0200 Avihai Horon wrote: > Pre-copy support allows the VFIO device data to be transferred while the > VM is running. This helps to accommodate VFIO devices that have a large > amount of data that needs to be transferred, and it can reduce migration > downtime. > >

Re: [SeaBIOS] [SeaBIOS PATCH] xen: require Xen info structure at 0x1000 to detect Xen

2023-01-26 Thread Kevin O'Connor
On Fri, Jan 20, 2023 at 11:33:19AM +, David Woodhouse wrote: > From: David Woodhouse > > When running under Xen, hvmloader places a table at 0x1000 with the e820 > information and BIOS tables. If this isn't present, SeaBIOS will > currently panic. > > We now have support for running Xen

[PATCH] target/arm: Fix physical address resolution for Stage2

2023-01-26 Thread Richard Henderson
Conversion to probe_access_full missed applying the page offset. Cc: qemu-sta...@nongnu.org Reported-by: Sid Manning Fixes: f3639a64f602 ("target/arm: Use softmmu tlbs for page table walking") Signed-off-by: Richard Henderson --- target/arm/ptw.c | 2 +- 1 file changed, 1 insertion(+), 1

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

2023-01-26 Thread Howard Spoelstra
On Thu, Jan 26, 2023 at 9:57 PM BALATON Zoltan wrote: > On Thu, 26 Jan 2023, Howard Spoelstra wrote: > > Mac OS X > > #10.0 bus1 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to adb > > mouse. No recognition as HID device. > > #10.0 bus2 kbd: usb_ohci_stop pci-ohci: USB Suspended. Up to

RE: ARM: ptw.c:S1_ptw_translate

2023-01-26 Thread Sid Manning
> -Original Message- > From: Richard Henderson > Sent: Thursday, January 26, 2023 3:48 PM > To: Sid Manning ; qemu-devel@nongnu.org > Cc: phi...@linaro.org; Mark Burton ; Alex > Bennée > Subject: Re: ARM: ptw.c:S1_ptw_translate > > WARNING: This email originated from outside of

Re: [PATCH] m68k: fix 'bkpt' instruction in softmmu mode

2023-01-26 Thread Mark Cave-Ayland
On 26/01/2023 12:52, Laurent Vivier wrote: In linux-user mode, 'bkpt' generates an EXP_DEBUG exception to allow QEMU gdb server to intercept and manage the operation with an external debugger. In softmmu mode, the instruction must generate an illegal instruction exception as it is on real

Re: [PATCH 2/2] hw/pxb-cxl: Support passthrough HDM Decoders unless overridden

2023-01-26 Thread Fan Ni
On Wed, Jan 25, 2023 at 03:27:03PM +, Jonathan Cameron wrote: > The CXL r3.0 specification allows for there to be no HDM decoders on CXL > Host Bridges if they have only a single root port. Instead, all accesses > directed to the host bridge (as specified in CXL Fixed Memory Windows) > are

Re: ARM: ptw.c:S1_ptw_translate

2023-01-26 Thread Richard Henderson
Please try the following. It's essentially the same bug I had for mte. I've just realized that the testing I did under Linux with virtualization=on was insufficient -- this path won't be exercised without KVM under TCG. diff --git a/target/arm/ptw.c b/target/arm/ptw.c index

Re: Fortnightly KVM call minutes for 2023-01-24

2023-01-26 Thread Bernhard Beschow
Am 24. Januar 2023 14:56:15 UTC schrieb Juan Quintela : > > > > >First part stolen from: >https://etherpad.opendev.org/p/qemu-emulation-bof%402023-01-24 > thanks Phillippe > >Single QEMU-system binary and Dynamic Machine Models > >Meeting link: https://meet.jit.si/kvmcallmeeting >Just

[PATCH v2 08/10] hw/ide: Let ide_init_ioport() take a MemoryRegion argument instead of ISADevice

2023-01-26 Thread Bernhard Beschow
Both callers to ide_init_ioport() have access to the I/O memory region of the ISA bus, so can pass it directly. This allows ide_init_ioport() to directly call portio_list_init(). Note, now the callers become the owner of the PortioList. Inspired-by: <20210518215545.1793947-10-phi...@redhat.com>

[PATCH v2 02/10] softmmu/ioport: Merge portio_list_add() into portio_list_init()

2023-01-26 Thread Bernhard Beschow
Both functions are always used together and in the same order. Let's reflect this in the API. Inspired-by: <20210518215545.1793947-9-phi...@redhat.com> 'hw/isa: Extract bus part from isa_register_portio_list()' Signed-off-by: Bernhard Beschow --- include/exec/ioport.h | 6 ++

[PATCH v2 05/10] Revert "hw/ide: Fix crash when plugging a piix3-ide device into the x-remote machine"

2023-01-26 Thread Bernhard Beschow
Now that the PIIX IDE device models check for presence of an ISABus before using it, this fix isn't needed any longer. This reverts commit 9405d87be25db6dff4d7b5ab48a81bbf6d083e47. Signed-off-by: Bernhard Beschow --- include/hw/ide/internal.h | 2 +- include/hw/isa/isa.h | 13

[PATCH v2 03/10] softmmu/ioport: Remove unused functions

2023-01-26 Thread Bernhard Beschow
Signed-off-by: Bernhard Beschow --- include/exec/ioport.h | 2 -- softmmu/ioport.c | 24 2 files changed, 26 deletions(-) diff --git a/include/exec/ioport.h b/include/exec/ioport.h index ec3e8e5942..1ef5aebba3 100644 --- a/include/exec/ioport.h +++

[PATCH v2 07/10] hw/ide/piix: Require an ISABus only for user-created instances

2023-01-26 Thread Bernhard Beschow
Internal instances now defer interrupt wiring to the caller which decouples them from the ISABus. User-created devices still fish out the ISABus from the QOM tree and the interrupt wiring remains in PIIX IDE. The latter mechanism is considered a workaround and intended to be removed once a

[PATCH v2 01/10] softmmu/ioport: Move portio_list_init() in front of portio_list_add()

2023-01-26 Thread Bernhard Beschow
This is a preparation for the next patch to keep its diff smaller. Signed-off-by: Bernhard Beschow --- softmmu/ioport.c | 41 - 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/softmmu/ioport.c b/softmmu/ioport.c index

[PATCH v2 04/10] hw/ide/piix: Disuse isa_get_irq()

2023-01-26 Thread Bernhard Beschow
isa_get_irq() asks for an ISADevice which piix-ide doesn't provide. Passing a NULL pointer works but causes the isabus global to be used then. By fishing out TYPE_ISA_BUS from the QOM tree it is possible to achieve the same as isa_get_irq(). This is an alternative solution to commit 9405d87be25d

[PATCH v2 10/10] hw/isa/isa-bus: Resolve isabus global

2023-01-26 Thread Bernhard Beschow
Now that only isa_bus_new() accesses the isabus global it can be removed assuming that all call sites take care of not passing the same address spaces to different isa_bus_new() invocations. Signed-off-by: Bernhard Beschow --- hw/isa/isa-bus.c | 8 ++-- 1 file changed, 2 insertions(+), 6

[PATCH v2 06/10] hw/ide/pci: Add PCIIDEState::isa_irqs[]

2023-01-26 Thread Bernhard Beschow
These legacy ISA IRQs allow the PIIX IDE functions to be wired up in their south bridges and the VIA IDE functions to disuse PCI_INTERRUPT_LINE as outlined in https://lists.nongnu.org/archive/html/ qemu-devel/2020-03/msg01707.html . Signed-off-by: Bernhard Beschow --- include/hw/ide/pci.h | 1 +

[PATCH v2 09/10] hw/isa: Remove use of global isa bus

2023-01-26 Thread Bernhard Beschow
From: Philippe Mathieu-Daudé In the previous commits we removed all calls to these functions passing a NULL ISADevice argument. We can simplify and remove the use of the global isabus object. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210518215545.1793947-11-phi...@redhat.com>

[PATCH v2 00/10] Resolve isabus global

2023-01-26 Thread Bernhard Beschow
This series resolves the global "isabus" variable and is basically a v2 of [1]. Note that the majority of the work consists of fixing ISA API calls in PIIX IDE which implicitly rely on the usage of the isabus global. Rather than adding an ISABus pointer in PCIIDEState as in [1] this series uses a

Re: [PATCH v5 32/36] target/s390x: Use tcg_gen_atomic_cmpxchg_i128 for CDSG

2023-01-26 Thread Richard Henderson
On 1/26/23 01:27, David Hildenbrand wrote:   static DisasJumpType op_csst(DisasContext *s, DisasOps *o) @@ -5419,6 +5410,14 @@ static void prep_r1_P(DisasContext *s, DisasOps *o)   }   #define SPEC_prep_r1_P SPEC_r1_even +static void prep_r1_D64(DisasContext *s, DisasOps *o) +{ +    int r1 =

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

2023-01-26 Thread BALATON Zoltan
On Thu, 26 Jan 2023, Howard Spoelstra wrote: Mac OS X #10.0 bus1 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to adb mouse. No recognition as HID device. #10.0 bus2 kbd: usb_ohci_stop pci-ohci: USB Suspended. Up to that point kbd pcap shows normal interrupt operation and recognition as

Re: Migration of download.qemu.org server in progress

2023-01-26 Thread Stefan Hajnoczi
SSL is working now. Stefan

Re: [PATCH v5 1/4] memory: prevent dma-reentracy issues

2023-01-26 Thread Peter Xu
On Thu, Jan 26, 2023 at 12:25:55AM -0500, Alexander Bulekov wrote: > Add a flag to the DeviceState, when a device is engaged in PIO/MMIO/DMA. > This flag is set/checked prior to calling a device's MemoryRegion > handlers, and set when device code initiates DMA. The purpose of this > flag is to

Re: no more pullreq processing til February

2023-01-26 Thread Alex Bennée
Thomas Huth writes: > On 26/01/2023 15.41, Peter Maydell wrote: >> On Thu, 26 Jan 2023 at 14:35, Daniel P. Berrangé wrote: >>> I'm confident we can rationalize our jobs, especially the cross >>> compilation ones. >>> >>> For each non-x86 arch we've got two sets of jobs, one for system >>>

Outdated QEMU microvm documentation

2023-01-26 Thread Stefan Hajnoczi
Hi, I noticed there is documentation for the microvm machine type: https://www.qemu.org/docs/master/system/i386/microvm.html Someone on IRC asked how to increase the number of VIRTIO devices and I noticed the docs appear to be outdated. It says there is no PCI or ACPI, but I believe the pcie=on

Migration of download.qemu.org server in progress

2023-01-26 Thread Stefan Hajnoczi
Hi, New hosting for download.qemu.org has been arranged. It made up a large portion of the bandwidth costs that we've been working on reducing. Paolo can give more details about the new hosting later, but I wanted to let everyone know that DNS is already pointing to the new server. If you

[PATCH 0/4] block: fix detect-zeroes= with BDRV_REQ_REGISTERED_BUF

2023-01-26 Thread Stefan Hajnoczi
The first patch fixes a regression in QEMU 7.2 where detect-zeroes breaks with virtio-blk devices due to a BDRV_REQ_REGISTERED_BUF bug. Details of the regression can be found here: https://gitlab.com/qemu-project/qemu/-/issues/1404 The remaining patches add a regression test that will protect

[PATCH 1/4] block: fix detect-zeroes= with BDRV_REQ_REGISTERED_BUF

2023-01-26 Thread Stefan Hajnoczi
When a write request is converted into a write zeroes request by the detect-zeroes= feature, it is no longer associated with an I/O buffer. The BDRV_REQ_REGISTERED_BUF flag doesn't make sense without an I/O buffer and must be cleared because bdrv_co_do_pwrite_zeroes() fails with -EINVAL when it's

[PATCH 2/4] qemu-io: use BdrvRequestFlags instead of int

2023-01-26 Thread Stefan Hajnoczi
The block layer APIs use BdrvRequestFlags while qemu-io code uses int. Although the code compiles and runs fine, BdrvRequestFlags is clearer because it differentiates between other types of flags like bdrv_open() flags. This is purely refactoring. Signed-off-by: Stefan Hajnoczi ---

[PATCH 3/4] qemu-io: add -r option to register I/O buffer

2023-01-26 Thread Stefan Hajnoczi
The blk_register_buf() API is an optimization hint that allows some block drivers to avoid I/O buffer housekeeping or bounce buffers. Add an -r option to register the I/O buffer so that qemu-io can be used to test the blk_register_buf() API. The next commit will add a test that uses the new

[PATCH 4/4] iotests/detect-zeroes-registered-buf: add new test

2023-01-26 Thread Stefan Hajnoczi
This regression test demonstrates that detect-zeroes works with registered buffers. Bug details: https://gitlab.com/qemu-project/qemu/-/issues/1404 Signed-off-by: Stefan Hajnoczi --- .../tests/detect-zeroes-registered-buf| 58 +++

Re: [PATCH 3/3] util/userfaultfd: Support /dev/userfaultfd

2023-01-26 Thread Peter Xu
On Thu, Jan 26, 2023 at 09:05:01AM +, Daniel P. Berrangé wrote: > On Thu, Jan 26, 2023 at 09:02:09AM +, Daniel P. Berrangé wrote: > > On Wed, Jan 25, 2023 at 05:40:16PM -0500, Peter Xu wrote: > > > Teach QEMU to use /dev/userfaultfd when it existed and fallback to the > > > system call if

RE: [PATCH v4 3/5] hw/nvram/eeprom_at24c: Add init_rom field and at24c_eeprom_init_rom helper

2023-01-26 Thread Ninad S Palsule
On 1/26/23, 11:19 AM, "Cédric Le Goater" mailto:c...@kaod.org>> wrote: On 1/26/23 17:23, Ninad S Palsule wrote: > Hi Cedric, > > Good suggestion but we will not be able to share those EEPROM image files yet. > We are trying to figure out how to sanitize them. For eeprom tests, they could

Re: [PATCH v5 03/36] tcg: Allocate objects contiguously in temp_allocate_frame

2023-01-26 Thread Richard Henderson
On 1/26/23 07:12, Alex Bennée wrote: +ts -= ts->temp_subindex; This seems a bit magic to me. Are we saying we always know there are TCGTemps "behind" ts because that is implied by temp_subindex? Not "implied" so much as "defined". It might be worth doing some documentation of the

Re: [PATCH] linux-user: Fix SO_ERROR return code of getsockopt()

2023-01-26 Thread Laurent Vivier
Le 26/01/2023 à 19:27, Helge Deller a écrit : On 1/26/23 17:55, Laurent Vivier wrote: Le 16/12/2022 à 11:10, Helge Deller a écrit : Add translation for the host error return code of: getsockopt(19, SOL_SOCKET, SO_ERROR, [ECONNREFUSED], [4]) = 0 This fixes the testsuite of the cockpit

[PATCH 14/18] intel-iommu: Implement get_attr() method

2023-01-26 Thread Avihai Horon
Implement get_attr() method and use the address width property to report the IOMMU_ATTR_MAX_IOVA attribute. Signed-off-by: Avihai Horon --- hw/i386/intel_iommu.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index

[PATCH 13/18] memory/iommu: Add IOMMU_ATTR_MAX_IOVA attribute

2023-01-26 Thread Avihai Horon
Add a new IOMMU attribute IOMMU_ATTR_MAX_IOVA which indicates the maximal IOVA that an IOMMU can use. This attribute will be used by VFIO device dirty page tracking so it can track the entire IOVA space when needed (i.e. when vIOMMU is enabled). Signed-off-by: Avihai Horon ---

[PATCH 16/18] vfio/common: Optimize device dirty page tracking with vIOMMU

2023-01-26 Thread Avihai Horon
When vIOMMU is enabled, syncing dirty page bitmaps is done by replaying the vIOMMU mappings and querying the dirty bitmap for each mapping. With device dirty tracking this causes a lot of overhead, since the HW is queried many times (even with small idle guest this can end up with thousands of

[PATCH 10/18] vfio/common: Extract code from vfio_get_dirty_bitmap() to new function

2023-01-26 Thread Avihai Horon
Extract the VFIO_IOMMU_DIRTY_PAGES ioctl code in vfio_get_dirty_bitmap() to its own function. This will help the code to be more readable after next patch will add device dirty page bitmap sync functionality. Signed-off-by: Avihai Horon --- hw/vfio/common.c | 53

[PATCH 09/18] vfio/common: Add device dirty page tracking start/stop

2023-01-26 Thread Avihai Horon
From: Joao Martins Add device dirty page tracking start/stop functionality. This uses the device DMA logging uAPI to start and stop dirty page tracking by device. Device dirty page tracking is used only if all devices within a container support device dirty page tracking. Signed-off-by: Joao

[PATCH 11/18] vfio/common: Add device dirty page bitmap sync

2023-01-26 Thread Avihai Horon
From: Joao Martins Add device dirty page bitmap sync functionality. This uses the device DMA logging uAPI to sync dirty page bitmap from the device. Device dirty page bitmap sync is used only if all devices within a container support device dirty page tracking. Signed-off-by: Joao Martins

[PATCH 06/18] util: Add iova_tree_nnodes()

2023-01-26 Thread Avihai Horon
From: Joao Martins Add iova_tree_nnodes() which returns the number of nodes in the IOVA tree. Signed-off-by: Joao Martins --- include/qemu/iova-tree.h | 11 +++ util/iova-tree.c | 5 + 2 files changed, 16 insertions(+) diff --git a/include/qemu/iova-tree.h

[PATCH 02/18] vfio/common: Fix error reporting in vfio_get_dirty_bitmap()

2023-01-26 Thread Avihai Horon
Return -errno instead of -1 if VFIO_IOMMU_DIRTY_PAGES ioctl fails in vfio_get_dirty_bitmap(). Signed-off-by: Avihai Horon --- hw/vfio/common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 93b18c5e3d..d892609cf1 100644 --- a/hw/vfio/common.c +++

[PATCH 15/18] vfio/common: Support device dirty page tracking with vIOMMU

2023-01-26 Thread Avihai Horon
Currently, device dirty page tracking with vIOMMU is not supported - RAM pages are perpetually marked dirty in this case. When vIOMMU is used, IOVA ranges are DMA mapped/unmapped on the fly as the vIOMMU maps/unmaps them. These IOVA ranges can potentially be mapped anywhere in the vIOMMU IOVA

[PATCH 17/18] vfio/migration: Query device dirty page tracking support

2023-01-26 Thread Avihai Horon
From: Joao Martins Now that everything has been set up for device dirty page tracking, query the device for device dirty page tracking support. Signed-off-by: Joao Martins Signed-off-by: Avihai Horon --- hw/vfio/migration.c | 15 +++ 1 file changed, 15 insertions(+) diff --git

[PATCH 07/18] util: Extend iova_tree_foreach() to take data argument

2023-01-26 Thread Avihai Horon
From: Joao Martins Extend iova_tree_foreach() to take data argument to be passed and used by the iterator. While at it, fix a documentation error: The documentation says iova_tree_foreach() returns a value even though it is a void function. Signed-off-by: Joao Martins ---

[PATCH 12/18] vfio/common: Extract vIOMMU code from vfio_sync_dirty_bitmap()

2023-01-26 Thread Avihai Horon
Extract vIOMMU code from vfio_sync_dirty_bitmap() to a new function and restructure the code. This is done as preparation for the following patches which will add vIOMMU support to device dirty page tracking. No functional changes intended. Signed-off-by: Avihai Horon --- hw/vfio/common.c | 63

[PATCH 18/18] docs/devel: Document VFIO device dirty page tracking

2023-01-26 Thread Avihai Horon
Adjust the VFIO dirty page tracking documentation and add a section to describe device dirty page tracking. Signed-off-by: Avihai Horon --- docs/devel/vfio-migration.rst | 50 ++- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git

[PATCH 05/18] vfio/common: Add VFIOBitmap and (de)alloc functions

2023-01-26 Thread Avihai Horon
There are already two places where dirty page bitmap allocation and calculations are done in open code. With device dirty page tracking being added in next patches, there are going to be even more places. To avoid code duplication, introduce VFIOBitmap struct and corresponding alloc and dealloc

[PATCH 00/18] vfio: Add migration pre-copy support and device dirty tracking

2023-01-26 Thread Avihai Horon
Hello, This series is based on the previous one that added the basic VFIO migration protocol v2 implementation [1]. The first patch in the series starts by adding pre-copy support for VFIO migration protocol v2. Pre-copy support allows the VFIO device data to be transferred while the VM is

[PATCH 04/18] vfio/common: Abort migration if dirty log start/stop/sync fails

2023-01-26 Thread Avihai Horon
If VFIO dirty pages log start/stop/sync fails during migration, migration should be aborted as pages dirtied by VFIO devices might not be reported properly. This is not the case today, where in such scenario only an error is printed. Fix it by aborting migration in the above scenario. Fixes:

[PATCH 08/18] vfio/common: Record DMA mapped IOVA ranges

2023-01-26 Thread Avihai Horon
From: Joao Martins According to the device DMA logging uAPI, IOVA ranges to be logged by the device must be provided all at once upon DMA logging start. As preparation for the following patches which will add device dirty page tracking, keep a record of all DMA mapped IOVA ranges so later they

[PATCH 01/18] vfio/migration: Add VFIO migration pre-copy support

2023-01-26 Thread Avihai Horon
Pre-copy support allows the VFIO device data to be transferred while the VM is running. This helps to accommodate VFIO devices that have a large amount of data that needs to be transferred, and it can reduce migration downtime. Pre-copy support is optional in VFIO migration protocol v2. Implement

[PATCH 03/18] vfio/common: Fix wrong %m usages

2023-01-26 Thread Avihai Horon
There are several places where the %m conversion is used if one of vfio_dma_map(), vfio_dma_unmap() or vfio_get_dirty_bitmap() fail. The %m usage in these places is wrong since %m relies on errno value while the above functions don't report errors via errno. Fix it by using strerror() with the

Re: [PATCH] hw/cxl: Add QTG _DSM support for ACPI0017 device

2023-01-26 Thread Jonathan Cameron via
On Thu, 26 Jan 2023 11:41:47 -0700 Dave Jiang wrote: > On 1/26/23 11:24 AM, Jonathan Cameron wrote: > > On Thu, 26 Jan 2023 11:07:37 -0700 > > Dave Jiang wrote: > > > > Hi Dave, > > > > That was quick! > > > >> Add a simple _DSM call support for the ACPI0017 device to return a fake QTG >

Re: [PATCH v4 0/3] riscv_load_fdt() semantics change

2023-01-26 Thread Conor Dooley
On Thu, Jan 26, 2023 at 10:52:16AM -0300, Daniel Henrique Barboza wrote: > Hi, > > After discussions in the previous version, where we ended up discovering > the details of why the current riscv_load_fdt() works with the Microchip > Icicle Kit board almost by accident, I decided to change how >

Re: [PATCH] linux-user: Fix SO_ERROR return code of getsockopt()

2023-01-26 Thread Helge Deller
On 1/26/23 17:55, Laurent Vivier wrote: Le 16/12/2022 à 11:10, Helge Deller a écrit : Add translation for the host error return code of: getsockopt(19, SOL_SOCKET, SO_ERROR, [ECONNREFUSED], [4]) = 0 This fixes the testsuite of the cockpit debian package with a hppa-linux guest on a x86-64

Re: [PATCH] hw/cxl: Add QTG _DSM support for ACPI0017 device

2023-01-26 Thread Jonathan Cameron via
On Thu, 26 Jan 2023 11:07:37 -0700 Dave Jiang wrote: Hi Dave, That was quick! > Add a simple _DSM call support for the ACPI0017 device to return a fake QTG > ID value. Given the current CXL implementation does not involve switches, I don't follow. What part doesn't involve switches? > a

Re: no more pullreq processing til February

2023-01-26 Thread Thomas Huth
On 26/01/2023 15.41, Peter Maydell wrote: On Thu, 26 Jan 2023 at 14:35, Daniel P. Berrangé wrote: I'm confident we can rationalize our jobs, especially the cross compilation ones. For each non-x86 arch we've got two sets of jobs, one for system emulators and one for user emulators. IMHO the

Re: [PATCH v2 1/2] qga-win: add logging to Windows event log

2023-01-26 Thread Andrey Drobyshev
On 1/23/23 22:52, Stefan Weil wrote: > Am 23.01.23 um 20:38 schrieb Andrey Drobyshev: > >> Hi Stefan, >> >> On 1/23/23 19:28, Stefan Weil wrote: >>> Hi, >>> >>> cross builds fail with this code. Please see details below. >>> >>> Am 29.11.22 um 18:38 schrieb Andrey Drobyshev via: This commit

Re: [SeaBIOS PATCH] xen: require Xen info structure at 0x1000 to detect Xen

2023-01-26 Thread Paul Durrant
On 20/01/2023 11:33, David Woodhouse wrote: From: David Woodhouse When running under Xen, hvmloader places a table at 0x1000 with the e820 information and BIOS tables. If this isn't present, SeaBIOS will currently panic. We now have support for running Xen guests natively in QEMU/KVM, which

Re: [PATCH v2 7/7] hw/mem/cxl_type3: Add CXL RAS Error Injection Support

2023-01-26 Thread Jonathan Cameron via
On Fri, 20 Jan 2023 14:24:50 + Jonathan Cameron via wrote: > CXL uses PCI AER Internal errors to signal to the host that an error has > occurred. The host can then read more detailed status from the CXL RAS > capability. > > For uncorrectable errors: support multiple injection in one

Re: [PATCH 3/3] util/userfaultfd: Support /dev/userfaultfd

2023-01-26 Thread Peter Xu
On Thu, Jan 26, 2023 at 12:08:33AM +0100, Philippe Mathieu-Daudé wrote: > On 25/1/23 23:40, Peter Xu wrote: > > Teach QEMU to use /dev/userfaultfd when it existed and fallback to the > > system call if either it's not there or doesn't have enough permission. > > > > Firstly, as long as the app

Re: [PATCH 0/3] util/userfaultfd: Support /dev/userfaultfd

2023-01-26 Thread Peter Xu
On Thu, Jan 26, 2023 at 03:59:33PM +, Daniel P. Berrangé wrote: > On Thu, Jan 26, 2023 at 10:25:05AM -0500, Peter Xu wrote: > > On Thu, Jan 26, 2023 at 02:15:11PM +, Dr. David Alan Gilbert wrote: > > > * Michal Prívozník (mpriv...@redhat.com) wrote: > > > > On 1/25/23 23:40, Peter Xu

[PATCH 10/13] vmdk: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper

2023-01-26 Thread Kevin Wolf
.bdrv_co_create implementations run in a coroutine. Therefore they are not allowed to open images directly. Fix the calls to use the corresponding no_co_wrappers instead. Signed-off-by: Kevin Wolf --- block/vmdk.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-)

[PATCH 07/13] qed: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper

2023-01-26 Thread Kevin Wolf
.bdrv_co_create implementations run in a coroutine. Therefore they are not allowed to open images directly. Fix the calls to use the corresponding no_co_wrappers instead. Signed-off-by: Kevin Wolf --- block/qed.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git

[PATCH 03/13] luks: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper

2023-01-26 Thread Kevin Wolf
.bdrv_co_create implementations run in a coroutine. Therefore they are not allowed to open images directly. Fix the calls to use the corresponding no_co_wrappers instead. Signed-off-by: Kevin Wolf --- block/crypto.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git

[PATCH 12/13] block: Fix bdrv_co_create_opts_simple() to open images with no_co_wrapper

2023-01-26 Thread Kevin Wolf
bdrv_co_create_opts_simpl() runs in a coroutine. Therefore it is not allowed to open images directly. Fix the call to use the corresponding no_co_wrapper instead. Signed-off-by: Kevin Wolf --- block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c

[PATCH 13/13] block: Assert non-coroutine context for bdrv_open_inherit()

2023-01-26 Thread Kevin Wolf
Signed-off-by: Kevin Wolf --- block.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/block.c b/block.c index 6eac16eac5..122aa9a9ac 100644 --- a/block.c +++ b/block.c @@ -3807,13 +3807,11 @@ out: * function eventually calls bdrv_refresh_total_sectors() which

[PATCH 09/13] vhdx: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper

2023-01-26 Thread Kevin Wolf
.bdrv_co_create implementations run in a coroutine. Therefore they are not allowed to open images directly. Fix the calls to use the corresponding no_co_wrappers instead. Signed-off-by: Kevin Wolf --- block/vhdx.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git

[PATCH 02/13] block: Create no_co_wrappers for open functions

2023-01-26 Thread Kevin Wolf
Images can't be opened in coroutine context because opening needs to change the block graph. Add no_co_wrappers so that coroutines have a simple way of opening images in a BH instead. At the same time, mark the wrapped functions as no_coroutine_fn. Signed-off-by: Kevin Wolf ---

[PATCH 05/13] qcow: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper

2023-01-26 Thread Kevin Wolf
.bdrv_co_create implementations run in a coroutine. Therefore they are not allowed to open images directly. Fix the calls to use the corresponding no_co_wrappers instead. Signed-off-by: Kevin Wolf --- block/qcow.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git

[PATCH 04/13] parallels: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper

2023-01-26 Thread Kevin Wolf
.bdrv_co_create implementations run in a coroutine. Therefore they are not allowed to open images directly. Fix the calls to use the corresponding no_co_wrappers instead. Signed-off-by: Kevin Wolf --- block/parallels.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git

[PATCH 08/13] vdi: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper

2023-01-26 Thread Kevin Wolf
.bdrv_co_create implementations run in a coroutine. Therefore they are not allowed to open images directly. Fix the calls to use the corresponding no_co_wrappers instead. Signed-off-by: Kevin Wolf --- block/vdi.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git

[PATCH 01/13] block-coroutine-wrapper: Introduce no_co_wrapper

2023-01-26 Thread Kevin Wolf
Some functions must not be called from coroutine context. The common pattern to use them anyway from a coroutine is running them in a BH and letting the calling coroutine yield to be woken up when the BH is completed. Instead of manually writing such wrappers, add support for generating them to

[PATCH 11/13] vpc: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper

2023-01-26 Thread Kevin Wolf
.bdrv_co_create implementations run in a coroutine. Therefore they are not allowed to open images directly. Fix the calls to use the corresponding no_co_wrappers instead. Signed-off-by: Kevin Wolf --- block/vpc.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git

[PATCH 00/13] block: Fix bdrv_open*() calls from coroutine context

2023-01-26 Thread Kevin Wolf
bdrv_open*() must not be called from coroutine context, amongst others because it modifies the block graph. However, some functions - in particular all .bdrv_co_create* implementations of image formats - do call it from coroutine context. This is already wrong today, but when we add locking, it

[PATCH 06/13] qcow2: Fix open/create to open images with no_co_wrapper

2023-01-26 Thread Kevin Wolf
.bdrv_co_create implementations run in a coroutine, as does qcow2_do_open(). Therefore they are not allowed to open images directly. Fix the calls to use the corresponding no_co_wrappers instead. Signed-off-by: Kevin Wolf --- block/qcow2.c | 43 ++- 1

Re: [PATCH v4 3/5] hw/nvram/eeprom_at24c: Add init_rom field and at24c_eeprom_init_rom helper

2023-01-26 Thread Cédric Le Goater
On 1/26/23 17:23, Ninad S Palsule wrote: Hi Cedric, Good suggestion but we will not be able to share those EEPROM image files yet. We are trying to figure out how to sanitize them. For eeprom tests, they could contain any data with some well know pattern to check. It could/should be

Re: [PATCH v5 03/36] tcg: Allocate objects contiguously in temp_allocate_frame

2023-01-26 Thread Alex Bennée
Richard Henderson writes: > When allocating a temp to the stack frame, consider the > base type and allocate all parts at once. > > Signed-off-by: Richard Henderson > --- > tcg/tcg.c | 30 ++ > 1 file changed, 22 insertions(+), 8 deletions(-) > > diff --git

  1   2   3   >