Re: ACPI endianness

2021-10-10 Thread Philippe Mathieu-Daudé
On 10/10/21 15:24, BALATON Zoltan wrote: > Hello, > > I'm trying to fix shutdown and reboot on pegasos2 which uses ACPI as > part of the VIA VT8231 (similar to and modelled in hw/isa/vt82c686b.c) > and found that the guest writes to ACPI PM1aCNT register come out with > wrong endianness but not

[PATCH v3 1/1] virtio: write back F_VERSION_1 before validate

2021-10-10 Thread Halil Pasic
The virtio specification virtio-v1.1-cs01 states: "Transitional devices MUST detect Legacy drivers by detecting that VIRTIO_F_VERSION_1 has not been acknowledged by the driver." This is exactly what QEMU as of 6.1 has done relying solely on VIRTIO_F_VERSION_1 for detecting that. However, the

[PATCH v3 11/12] vfio-user: register handlers to facilitate migration

2021-10-10 Thread Jagannathan Raman
Store and load the device's state during migration. use libvfio-user's handlers for this purpose Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman --- migration/savevm.h| 2 + hw/remote/vfio-user-obj.c | 339

[PATCH v3 09/12] vfio-user: handle PCI BAR accesses

2021-10-10 Thread Jagannathan Raman
Determine the BARs used by the PCI device and register handlers to manage the access to the same. Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman --- hw/remote/vfio-user-obj.c | 90 +++ hw/remote/trace-events

[PATCH v3 05/12] vfio-user: find and init PCI device

2021-10-10 Thread Jagannathan Raman
Find the PCI device with specified id. Initialize the device context with the QEMU PCI device Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman --- hw/remote/vfio-user-obj.c | 32 1 file changed, 32 insertions(+)

[PATCH v3 04/12] vfio-user: instantiate vfio-user context

2021-10-10 Thread Jagannathan Raman
create a context with the vfio-user library to run a PCI device Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman --- hw/remote/vfio-user-obj.c | 38 ++ 1 file changed, 38 insertions(+) diff --git

[PATCH v3 10/12] vfio-user: handle device interrupts

2021-10-10 Thread Jagannathan Raman
Forward remote device's interrupts to the guest Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman Reviewed-by: Stefan Hajnoczi --- include/hw/remote/iohub.h | 2 ++ hw/remote/iohub.c | 5 + hw/remote/vfio-user-obj.c | 28

[PATCH v3 12/12] vfio-user: acceptance test

2021-10-10 Thread Jagannathan Raman
Acceptance test for libvfio-user in QEMU Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman --- MAINTAINERS | 1 + tests/acceptance/vfio-user.py | 96 +++ 2 files changed, 97 insertions(+) create

[PATCH v3 03/12] vfio-user: define vfio-user-server object

2021-10-10 Thread Jagannathan Raman
Define vfio-user object which is remote process server for QEMU. Setup object initialization functions and properties necessary to instantiate the object Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman --- qapi/qom.json | 20 -

[PATCH v3 08/12] vfio-user: handle DMA mappings

2021-10-10 Thread Jagannathan Raman
Define and register callbacks to manage the RAM regions used for device DMA Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman Reviewed-by: Stefan Hajnoczi --- hw/remote/vfio-user-obj.c | 50 +++

[PATCH v3 06/12] vfio-user: run vfio-user context

2021-10-10 Thread Jagannathan Raman
Setup a handler to run vfio-user context. The context is driven by messages to the file descriptor associated with it - get the fd for the context and hook up the handler with it Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman ---

[PATCH v3 07/12] vfio-user: handle PCI config space accesses

2021-10-10 Thread Jagannathan Raman
Define and register handlers for PCI config space accesses Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman --- hw/remote/vfio-user-obj.c | 45 +++ hw/remote/trace-events| 2 ++ 2 files changed, 47

[PATCH v3 00/12] vfio-user server in QEMU

2021-10-10 Thread Jagannathan Raman
Based-on: Hi, Thank you very much for reviewing the patches in the previous revision! We have addressed most of comments from v2. We are working on MSI-x support (used by PCIe devices such as “nvme”) and a couple of comments in the migration patches. We hope these two items will be in the

[PATCH v3 02/12] vfio-user: build library

2021-10-10 Thread Jagannathan Raman
add the libvfio-user library as a submodule. build it as a cmake subproject. Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman --- configure | 13 +++- meson.build| 39

[PATCH v3 01/12] configure, meson: override C compiler for cmake

2021-10-10 Thread Jagannathan Raman
The compiler path that cmake gets from meson is corrupted. It results in the following error: | -- The C compiler identification is unknown | CMake Error at CMakeLists.txt:35 (project): | The CMAKE_C_COMPILER: | /opt/rh/devtoolset-9/root/bin/cc;-m64;-mcx16 | is not a full path to an existing

Re: [PATCH 1/2] hw/core/machine: Split out smp_parse as an inline API

2021-10-10 Thread Markus Armbruster
Yanan Wang writes: > Functionally smp_parse() is only called once and in one place > i.e. machine_set_smp, the possible second place where it'll be > called should be some unit tests if any. > > Actually we are going to introduce an unit test for the parser. > For necessary isolation of the

[PATCH V4 05/10] net: introduce control client

2021-10-10 Thread Jason Wang
This patch introduces a boolean for the device has control queue which can accepts control command via network queue. The first user would be the control virtqueue support for vhost. Signed-off-by: Jason Wang Message-Id: <20210907090322.1756-6-jasow...@redhat.com> Reviewed-by: Michael S.

[PATCH V4 07/10] virtio-net: use "queue_pairs" instead of "queues" when possible

2021-10-10 Thread Jason Wang
Most of the time, "queues" really means queue pairs. So this patch switch to use "queue_pairs" to avoid confusion. Signed-off-by: Jason Wang Message-Id: <20210907090322.1756-8-jasow...@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/net/vhost_net.c

[PATCH V4 03/10] vhost-vdpa: prepare for the multiqueue support

2021-10-10 Thread Jason Wang
Unlike vhost-kernel, vhost-vdpa adapts a single device multiqueue model. So we need to simply use virtqueue index as the vhost virtqueue index. This is a must for multiqueue to work for vhost-vdpa. Signed-off-by: Jason Wang Message-Id: <20210907090322.1756-4-jasow...@redhat.com> Reviewed-by:

[PATCH V4 08/10] vhost: record the last virtqueue index for the virtio device

2021-10-10 Thread Jason Wang
This patch introduces a new field in the vhost_dev structure to record the last virtqueue index for the virtio device. This will be useful for the vhost backends with 1:N model to start or stop the device after all the vhost_dev structures were started or stopped. Signed-off-by: Jason Wang

[PATCH V4 02/10] vhost-vdpa: classify one time request

2021-10-10 Thread Jason Wang
Vhost-vdpa uses one device multiqueue queue (pairs) model. So we need to classify the one time request (e.g SET_OWNER) and make sure those request were only called once per device. This is used for multiqueue support. Signed-off-by: Jason Wang Message-Id:

Re: [PATCH 3/8] accel/tcg: Support TCG_TARGET_SIGNED_ADDR32 for softmmu

2021-10-10 Thread WANG Xuerui
Hi Richard, On 2021/10/11 01:43, Richard Henderson wrote: > When TCG_TARGET_SIGNED_ADDR32 is set, adjust the tlb addend to > allow the 32-bit guest address to be sign extended within the > 64-bit host register instead of zero extended. > > This will simplify tcg hosts like MIPS, RISC-V, and

[PATCH V4 06/10] vhost-net: control virtqueue support

2021-10-10 Thread Jason Wang
We assume there's no cvq in the past, this is not true when we need control virtqueue support for vhost-user backends. So this patch implements the control virtqueue support for vhost-net. As datapath, the control virtqueue is also required to be coupled with the NetClientState. The

[PATCH V4 09/10] virtio-net: vhost control virtqueue support

2021-10-10 Thread Jason Wang
This patch implements the control virtqueue support for vhost. This requires virtio-net to figure out the datapath queue pairs and control virtqueue via is_datapath and pass the number of those two types of virtqueues to vhost_net_start()/vhost_net_stop(). Signed-off-by: Jason Wang Message-Id:

[PATCH V4 10/10] vhost-vdpa: multiqueue support

2021-10-10 Thread Jason Wang
This patch implements the multiqueue support for vhost-vdpa. This is done simply by reading the number of queue pairs from the config space and initialize the datapath and control path net client. Signed-off-by: Jason Wang Message-Id: <20210907090322.1756-11-jasow...@redhat.com> Reviewed-by:

[PATCH V4 04/10] vhost-vdpa: let net_vhost_vdpa_init() returns NetClientState *

2021-10-10 Thread Jason Wang
This patch switches to let net_vhost_vdpa_init() to return NetClientState *. This is used for the callers to allocate multiqueue NetClientState for multiqueue support. Signed-off-by: Jason Wang Message-Id: <20210907090322.1756-5-jasow...@redhat.com> Reviewed-by: Michael S. Tsirkin

[PATCH V4 01/10] vhost-vdpa: open device fd in net_init_vhost_vdpa()

2021-10-10 Thread Jason Wang
This patch switches to open device fd in net_init_vhost_vpda(). This is used to prepare for the multiqueue support. Reviewed-by: Stefano Garzarella Signed-off-by: Jason Wang Message-Id: <20210907090322.1756-2-jasow...@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S.

[PATCH V4 00/10] vhost-vDPA multiqueue

2021-10-10 Thread Jason Wang
Hi All: This patch implements the multiqueue support for vhost-vDPA. The most important requirement si the control virtqueue support. The virtio-net and vhost-net core are tweak to support control virtqueue as if what data queue pairs are done: a dedicated vhost_net device which is coupled with

Re: [PATCH 2/8] accel/tcg: Split out g2h_tlbe

2021-10-10 Thread WANG Xuerui
On 2021/10/11 01:43, Richard Henderson wrote: > Create a new function to combine a CPUTLBEntry addend > with the guest address to form a host address. > > Signed-off-by: Richard Henderson > --- > accel/tcg/cputlb.c | 24 ++-- > 1 file changed, 14 insertions(+), 10

Re: [PATCH 1/8] tcg: Add TCG_TARGET_SIGNED_ADDR32

2021-10-10 Thread WANG Xuerui
On 2021/10/11 01:43, Richard Henderson wrote: > Define as 0 for all tcg hosts. Put this in a separate header, > because we'll want this in places that do not ordinarily have > access to all of tcg/tcg.h. > > Signed-off-by: Richard Henderson > --- > tcg/aarch64/tcg-target-sa32.h | 1 + >

Re: [PATCH 7/8] target/mips: Support TCG_TARGET_SIGNED_ADDR32

2021-10-10 Thread WANG Xuerui
Hi Richard, On 2021/10/11 01:44, Richard Henderson wrote: > All 32-bit mips operations sign-extend the output, so we are easily > able to keep TCG_TYPE_I32 values sign-extended in host registers. > > Signed-off-by: Richard Henderson > --- > tcg/mips/tcg-target-sa32.h | 8 >

Re: [PULL 00/57] pc,pci,virtio: features, fixes

2021-10-10 Thread Jason Wang
On Wed, Oct 6, 2021 at 5:32 AM Michael S. Tsirkin wrote: > > On Tue, Oct 05, 2021 at 10:21:43AM -0700, Richard Henderson wrote: > > On 10/5/21 9:00 AM, Michael S. Tsirkin wrote: > > > The following changes since commit > > > 9618c5badaa8eed25259cf095ff880efb939fbe7: > > > > > >Merge

Re: [PATCH] generic-loader: remove the ram_size limit when a loading binary file

2021-10-10 Thread Alistair Francis
On Fri, Oct 8, 2021 at 8:38 PM Damien Hedde wrote: > > > > On 10/7/21 09:59, Philippe Mathieu-Daudé wrote: > > On 10/7/21 08:41, Alistair Francis wrote: > >> On Wed, Oct 6, 2021 at 10:04 PM Damien Hedde > >> wrote: > >>> On 10/6/21 13:49, Philippe Mathieu-Daudé wrote: > On 10/6/21 13:37,

Re: [PATCH] hw/misc: applesmc: use host osk as default on macs

2021-10-10 Thread Pedro Tôrres
AFAIK there’s no public documentation from Apple on how to read values from SMC. But Amit Singh wrote a book, Mac OS X Internals, and one of the processes described on it is how to read OSK directly from SMC:

Re: [PATCH] hw/misc: applesmc: use host osk as default on macs

2021-10-10 Thread Paolo Bonzini
Can you instead provide documentation in English (pseudocode, tables of the structs, etc.)? That's the safest bet. Paolo El sáb., 9 oct. 2021 7:32, Pedro Tôrres escribió: > Hey Paolo and Phil, > > I understand you concerns regarding the license that Apple open-source > code is distributed. > >

[PATCH] multiboot: Use DMA instead port-based transfer

2021-10-10 Thread Adam Lackorzynski
Use DMA transfers in the multiboot loader to copy data. This significantly lowers QEMU's startup latency by a factor of about 40, for example, going from 30sec to 0.8sec when loading modules of 120MB in size. This change has been used successfully for some time. Signed-off-by: Marcus Hähnel

Re: [PATCH V4] block/rbd: implement bdrv_co_block_status

2021-10-10 Thread Ilya Dryomov
On Thu, Oct 7, 2021 at 6:28 PM Peter Lieven wrote: > > the qemu rbd driver currently lacks support for bdrv_co_block_status. > This results mainly in incorrect progress during block operations (e.g. > qemu-img convert with an rbd image as source). > > This patch utilizes the rbd_diff_iterate2

[PATCH 4/8] accel/tcg: Add guest_base_signed_addr32 for user-only

2021-10-10 Thread Richard Henderson
While the host may prefer to treat 32-bit addresses as signed, there are edge cases of guests that cannot be implemented with addresses 0x7fff_ and 0x8000_ being non-consecutive. Therefore, default to guest_base_signed_addr32 false, and allow probe_guest_base to determine whether it is

[PATCH 8/8] target/riscv: Support TCG_TARGET_SIGNED_ADDR32

2021-10-10 Thread Richard Henderson
All RV64 32-bit operations sign-extend the output, so we are easily able to keep TCG_TYPE_I32 values sign-extended in host registers. Signed-off-by: Richard Henderson --- tcg/riscv/tcg-target-sa32.h | 6 +- tcg/riscv/tcg-target.c.inc | 8 ++-- 2 files changed, 7 insertions(+), 7

[PATCH 1/8] tcg: Add TCG_TARGET_SIGNED_ADDR32

2021-10-10 Thread Richard Henderson
Define as 0 for all tcg hosts. Put this in a separate header, because we'll want this in places that do not ordinarily have access to all of tcg/tcg.h. Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target-sa32.h | 1 + tcg/arm/tcg-target-sa32.h | 1 + tcg/i386/tcg-target-sa32.h|

[PATCH 6/8] tcg/aarch64: Support TCG_TARGET_SIGNED_ADDR32

2021-10-10 Thread Richard Henderson
AArch64 has both sign and zero-extending addressing modes, which means that either treatment of guest addresses is equally efficient. Enabling this for AArch64 gives us testing of the feature in CI. Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target-sa32.h | 8 -

[PATCH 5/8] linux-user: Support TCG_TARGET_SIGNED_ADDR32

2021-10-10 Thread Richard Henderson
When using reserved_va, which is the default for a 64-bit host and a 32-bit guest, set guest_base_signed_addr32 if requested by TCG_TARGET_SIGNED_ADDR32, and the executable layout allows. Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 4 --- linux-user/elfload.c | 62

[PATCH 7/8] target/mips: Support TCG_TARGET_SIGNED_ADDR32

2021-10-10 Thread Richard Henderson
All 32-bit mips operations sign-extend the output, so we are easily able to keep TCG_TYPE_I32 values sign-extended in host registers. Signed-off-by: Richard Henderson --- tcg/mips/tcg-target-sa32.h | 8 tcg/mips/tcg-target.c.inc | 13 +++-- 2 files changed, 11 insertions(+),

[PATCH 3/8] accel/tcg: Support TCG_TARGET_SIGNED_ADDR32 for softmmu

2021-10-10 Thread Richard Henderson
When TCG_TARGET_SIGNED_ADDR32 is set, adjust the tlb addend to allow the 32-bit guest address to be sign extended within the 64-bit host register instead of zero extended. This will simplify tcg hosts like MIPS, RISC-V, and LoongArch, which naturally sign-extend 32-bit values, in contrast to

[PATCH 2/8] accel/tcg: Split out g2h_tlbe

2021-10-10 Thread Richard Henderson
Create a new function to combine a CPUTLBEntry addend with the guest address to form a host address. Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c

[PATCH 0/8] tcg: support 32-bit guest addresses as signed

2021-10-10 Thread Richard Henderson
We have 2, and nearly 3, hosts that naturally produce sign-extended values, and have to work extra hard (with 1 or 2 insns) to produce the zero-extended address that we expect today. However, it's a simple matter of arithmetic for the middle-end to require sign-extended addresses instead. For

Re: [RFC PATCH 00/13] target/riscv: Rationalize XLEN and operand length

2021-10-10 Thread Frédéric Pétrot
Le 07/10/2021 à 19:47, Richard Henderson a écrit : > This is a partial patch set attempting to set things in the > right direction for both the UXL and RV128 patch sets. > > One of the things that struck me while reading the RV128 patches > is the proliferation of riscv_cpu_is_bits functions.

Re: ACPI endianness

2021-10-10 Thread BALATON Zoltan
On Sun, 10 Oct 2021, Michael S. Tsirkin wrote: On Sun, Oct 10, 2021 at 03:24:32PM +0200, BALATON Zoltan wrote: Hello, I'm trying to fix shutdown and reboot on pegasos2 which uses ACPI as part of the VIA VT8231 (similar to and modelled in hw/isa/vt82c686b.c) and found that the guest writes to

Re: ACPI endianness

2021-10-10 Thread Michael S. Tsirkin
On Sun, Oct 10, 2021 at 03:24:32PM +0200, BALATON Zoltan wrote: > Hello, > > I'm trying to fix shutdown and reboot on pegasos2 which uses ACPI as part of > the VIA VT8231 (similar to and modelled in hw/isa/vt82c686b.c) and found > that the guest writes to ACPI PM1aCNT register come out with wrong

ACPI endianness

2021-10-10 Thread BALATON Zoltan
Hello, I'm trying to fix shutdown and reboot on pegasos2 which uses ACPI as part of the VIA VT8231 (similar to and modelled in hw/isa/vt82c686b.c) and found that the guest writes to ACPI PM1aCNT register come out with wrong endianness but not shure why. I have this: $ qemu-system-ppc -M

Re: [PATCH] tests: tcg: Fix PVH test with binutils 2.36+

2021-10-10 Thread Alex Bennée
Cole Robinson writes: > binutils started adding a .note.gnu.property ELF section which > makes the PVH test fail: > > TESThello on x86_64 > qemu-system-x86_64: Error loading uncompressed kernel without PVH ELF Note > > Discard .note.gnu* while keeping the PVH .note bits intact. > > This

[PATCH 1/2] hw/core/machine: Split out smp_parse as an inline API

2021-10-10 Thread Yanan Wang
Functionally smp_parse() is only called once and in one place i.e. machine_set_smp, the possible second place where it'll be called should be some unit tests if any. Actually we are going to introduce an unit test for the parser. For necessary isolation of the tested code, split smp_parse out

[PATCH 0/2] hw/core/machine: An an unit test for smp_parse

2021-10-10 Thread Yanan Wang
Hi, This series introduces an unit test for generic smp_parse(). We have had enough discussions about what kind of SMP configurations by the user should be considered valid and what should be invalid. Since we have finished optimizing the SMP parsing code, then this test normatively listed all

[PATCH 2/2] tests/unit: Add an unit test for smp parsing

2021-10-10 Thread Yanan Wang
Now that we have a generic parser smp_parse(), let's add an unit test for the code. All possible valid/invalid SMP configurations that the user can specify are covered. Signed-off-by: Yanan Wang --- MAINTAINERS | 1 + tests/unit/meson.build | 1 +