[PATCH v2 2/5] ppc/pnv: Subclass quad xscom callbacks

2023-07-03 Thread Joel Stanley
Make the existing pnv_quad_xscom_read/write be P9 specific, in preparation for a different P10 callback. Reviewed-by: Cédric Le Goater Signed-off-by: Joel Stanley --- v2: Add scom region size to class --- include/hw/ppc/pnv_core.h | 13 - hw/ppc/pnv.c | 11 +++

[PATCH v2 1/5] ppc/pnv: quad xscom callbacks are P9 specific

2023-07-03 Thread Joel Stanley
Rename the functions to include P9 in the name in preparation for adding P10 versions. Correct the unimp read message while we're changing the function. Reviewed-by: Cédric Le Goater Signed-off-by: Joel Stanley --- v2: Fix unimp print, and grammar in the commit message --- hw/ppc/pnv_core.c |

[PATCH v2 0/5] ppc/pnv: Extend "quad" model for p10

2023-07-03 Thread Joel Stanley
The quad model implements the EC xscoms for the p9 machine, reusing the same model for p10 which isn't quite correct. This series adds a PnvQuad class and subclasses it for P9 and P10. I mistakenly thought we needed the quad model to implement the core thread state scom on p10, because the read

[PATCH v2 4/5] ppc/pnv: Add P10 core xscom model

2023-07-03 Thread Joel Stanley
Like the quad xscoms, add a core model for P10 to allow future differentiation from P9. Signed-off-by: Joel Stanley --- hw/ppc/pnv_core.c | 44 ++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c index

[PATCH v2 5/5] ppc/pnv: Return zero for core thread state xscom

2023-07-03 Thread Joel Stanley
Firmware now warns if booting in LPAR per core mode (PPC bit 62). So this warning doesn't trigger, report the core thread state is 0. Reviewed-by: Cédric Le Goater Signed-off-by: Joel Stanley --- hw/ppc/pnv_core.c | 10 ++ 1 file changed, 10 insertions(+) diff --git

[PATCH v2 3/5] ppc/pnv: Add P10 quad xscom model

2023-07-03 Thread Joel Stanley
Add a PnvQuad class for the P10 powernv machine. No xscoms are implemented yet, but this allows them to be added. The size is reduced to avoid the quad region from overlapping with the core region. address-space: xscom-0 -0003 (prio 0, i/o): xscom-0

Re: [PATCH v6 5/5] hw/pci: ensure PCIE devices are plugged into only slot 0 of PCIE port

2023-07-03 Thread Ani Sinha
> On 04-Jul-2023, at 10:31 AM, Akihiko Odaki wrote: > > On 2023/07/03 15:08, Ani Sinha wrote: >>> On 02-Jul-2023, at 10:29 AM, Michael S. Tsirkin wrote: >>> >>> On Sat, Jul 01, 2023 at 04:09:31PM +0900, Akihiko Odaki wrote: Yes, I want the slot number restriction to be enforced. If it

Re: [PATCH v6 5/5] hw/pci: ensure PCIE devices are plugged into only slot 0 of PCIE port

2023-07-03 Thread Akihiko Odaki
On 2023/07/03 15:08, Ani Sinha wrote: On 02-Jul-2023, at 10:29 AM, Michael S. Tsirkin wrote: On Sat, Jul 01, 2023 at 04:09:31PM +0900, Akihiko Odaki wrote: Yes, I want the slot number restriction to be enforced. If it worries you too much for regressions, you may implement it as a warning

[PATCH v3 2/3] vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_mq()

2023-07-03 Thread Hawkins Jiawei
According to VirtIO standard, "The class, command and command-specific-data are set by the driver, and the device sets the ack byte. There is little it can do except issue a diagnostic if ack is not VIRTIO_NET_OK." Therefore, QEMU should stop sending the queued SVQ commands and cancel the device

[PATCH v3 1/3] vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_mac()

2023-07-03 Thread Hawkins Jiawei
According to VirtIO standard, "The class, command and command-specific-data are set by the driver, and the device sets the ack byte. There is little it can do except issue a diagnostic if ack is not VIRTIO_NET_OK." Therefore, QEMU should stop sending the queued SVQ commands and cancel the device

[PATCH v3 3/3] vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_offloads()

2023-07-03 Thread Hawkins Jiawei
According to VirtIO standard, "The class, command and command-specific-data are set by the driver, and the device sets the ack byte. There is little it can do except issue a diagnostic if ack is not VIRTIO_NET_OK." Therefore, QEMU should stop sending the queued SVQ commands and cancel the device

[PATCH v3 0/3] vdpa: Return -EIO if device ack is VIRTIO_NET_ERR

2023-07-03 Thread Hawkins Jiawei
According to VirtIO standard, "The class, command and command-specific-data are set by the driver, and the device sets the ack byte. There is little it can do except issue a diagnostic if ack is not VIRTIO_NET_OK." Therefore, QEMU should stop sending the queued SVQ commands and cancel the device

Re: [PATCH 2/2] tpm_crb: mark memory as protected

2023-07-03 Thread Jason Wang
On Thu, Jun 22, 2023 at 9:39 PM Laurent Vivier wrote: > > On 6/22/23 15:12, Peter Maydell wrote: > > On Tue, 20 Jun 2023 at 20:51, Laurent Vivier wrote: > >> > >> This memory is not correctly aligned and cannot be registered > >> by vDPA and VFIO. > > > > Isn't this a vDPA/VFIO problem? There's

[PATCH v2 1/2] target/riscv: Remove redundant check in pmp_is_locked

2023-07-03 Thread Ruibo Lu
the check of top PMP is redundant and will not influence the return value, so consider remove it Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis Signed-off-by: Ruibo Lu --- target/riscv/pmp.c | 5 - 1 file changed, 5 deletions(-) diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c

[PATCH v2 2/2] target/riscv: Optimize ambiguous local variable in pmp_hart_has_privs

2023-07-03 Thread Ruibo Lu
These two values represents whether start/end address is in pmp_range. However, the type and name of them is ambiguous. This commit change the name and type of them to improve code readability and accuracy. Reviewed-by: Weiwei Li Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Ruibo Lu ---

RE: [PATCH v6 5/7] vfio/migration: Free resources when vfio_migration_realize fails

2023-07-03 Thread Duan, Zhenzhong
>-Original Message- >From: Cédric Le Goater >Sent: Monday, July 3, 2023 11:45 PM >Subject: Re: [PATCH v6 5/7] vfio/migration: Free resources when >vfio_migration_realize fails > >On 7/3/23 09:15, Zhenzhong Duan wrote: >> When vfio_realize() succeeds, hot unplug will call vfio_exitfn() to

RE: [PATCH v6 5/7] vfio/migration: Free resources when vfio_migration_realize fails

2023-07-03 Thread Duan, Zhenzhong
>-Original Message- >From: Duan, Zhenzhong >Sent: Monday, July 3, 2023 3:15 PM >To: qemu-devel@nongnu.org >Cc: alex.william...@redhat.com; c...@redhat.com; Martins, Joao >; avih...@nvidia.com; Peng, Chao P > >Subject: [PATCH v6 5/7] vfio/migration: Free resources when

Re: [PATCH RFC 1/1] vdpa: Return -EINVAL if device's ack is VIRTIO_NET_ERR

2023-07-03 Thread Hawkins Jiawei
On 2023/7/4 0:52, Michael S. Tsirkin wrote: > On Wed, Jun 14, 2023 at 09:01:47PM +0800, Hawkins Jiawei wrote: >> According to VirtIO standard, "The class, command and >> command-specific-data are set by the driver, >> and the device sets the ack byte. >> There is little it can do except issue a

Re: [PATCH RFC 1/1] vdpa: Return -EINVAL if device's ack is VIRTIO_NET_ERR

2023-07-03 Thread Hawkins Jiawei
On 2023/7/4 0:38, Eugenio Perez Martin wrote: > On Wed, Jun 14, 2023 at 3:02 PM Hawkins Jiawei wrote: >> >> According to VirtIO standard, "The class, command and >> command-specific-data are set by the driver, >> and the device sets the ack byte. >> There is little it can do except issue a

Re: [PATCH RESEND v2 2/2] target/i386/kvm: get and put AMD pmu registers

2023-07-03 Thread Dongli Zhang
Hi Like, On 7/2/23 07:15, Like Xu wrote: > On Wed, Jun 21, 2023 at 9:39 AM Dongli Zhang wrote: >> >> The QEMU side calls kvm_get_msrs() to save the pmu registers from the KVM >> side to QEMU, and calls kvm_put_msrs() to store the pmu registers back to >> the KVM side. >> >> However, only the

Re: [PATCH] riscv: Generate devicetree only after machine initialization is complete

2023-07-03 Thread Daniel Henrique Barboza
On 7/3/23 18:18, Guenter Roeck wrote: On 7/3/23 12:25, Daniel Henrique Barboza wrote: On 7/3/23 00:46, Guenter Roeck wrote: If the devicetree is created before machine initialization is complete, it misses dynamic devices. Specifically, the tpm device is not added to the devicetree file and

[PATCH 13/13] ppc440_pcix: Stop using system io region for PCI bus

2023-07-03 Thread BALATON Zoltan
Use the iomem region for the PCI io space and map it directly from the board without an intermediate alias that is not really needed. Signed-off-by: BALATON Zoltan --- hw/ppc/ppc440_pcix.c | 8 +--- hw/ppc/sam460ex.c| 6 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff

[PATCH 01/13] ppc440: Change ppc460ex_pcie_init() parameter type

2023-07-03 Thread BALATON Zoltan
Change parameter of ppc460ex_pcie_init() from env to cpu to allow further refactoring. Signed-off-by: BALATON Zoltan --- hw/ppc/ppc440.h| 2 +- hw/ppc/ppc440_uc.c | 7 --- hw/ppc/sam460ex.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/ppc/ppc440.h

[PATCH 00/13] PPC440 devices misc clean up

2023-07-03 Thread BALATON Zoltan
These are some small misc clean ups to PPC440 related device models which is all I have ready for now. BALATON Zoltan (13): ppc440: Change ppc460ex_pcie_init() parameter type ppc440: Add cpu link property to PCIe controller model ppc440: Add a macro to shorten PCIe controller DCR

[PATCH 10/13] ppc4xx_pci: Add define for ppc4xx-host-bridge type name

2023-07-03 Thread BALATON Zoltan
Add a QOM type name define for ppc4xx-host-bridge in the common header and replace direct use of the string name with the constant. Signed-off-by: BALATON Zoltan --- hw/ppc/ppc440_pcix.c| 3 ++- hw/ppc/ppc4xx_pci.c | 4 ++-- include/hw/ppc/ppc4xx.h | 1 + 3 files changed, 5

[PATCH 05/13] ppc440: Stop using system io region for PCIe buses

2023-07-03 Thread BALATON Zoltan
Add separate memory regions for the mem and io spaces of the PCIe bus to avoid different buses using the same system io region. Signed-off-by: BALATON Zoltan --- hw/ppc/ppc440_uc.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/ppc/ppc440_uc.c

[PATCH 09/13] ppc4xx_pci: Rename QOM type name define

2023-07-03 Thread BALATON Zoltan
Rename the TYPE_PPC4xx_PCI_HOST_BRIDGE define and its string value to match each other and other similar types and to avoid confusion with "ppc4xx-host-bridge" type defined in same file. Signed-off-by: BALATON Zoltan --- hw/ppc/ppc440_bamboo.c | 3 +-- hw/ppc/ppc4xx_pci.c | 6 +++---

[PATCH 06/13] sam460ex: Remove address_space_mem local variable

2023-07-03 Thread BALATON Zoltan
Some places already use get_system_memory() directly so replace the remaining uses and drop the local variable. Signed-off-by: BALATON Zoltan --- hw/ppc/sam460ex.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index

[PATCH 08/13] ppc440: Remove ppc460ex_pcie_init legacy init function

2023-07-03 Thread BALATON Zoltan
After previous changes we can now remove the legacy init function and move the device creation to board code. Signed-off-by: BALATON Zoltan --- hw/ppc/ppc440.h | 1 - hw/ppc/ppc440_uc.c | 21 - hw/ppc/sam460ex.c | 17 -

[PATCH 11/13] ppc440_pcix: Rename QOM type define abd move it to common header

2023-07-03 Thread BALATON Zoltan
Rename TYPE_PPC440_PCIX_HOST_BRIDGE to better match its string value, move it to common header and use it also in sam460ex to replace hard coded type name. Signed-off-by: BALATON Zoltan --- hw/ppc/ppc440_pcix.c| 9 - hw/ppc/sam460ex.c | 2 +- include/hw/ppc/ppc4xx.h | 1 + 3

[PATCH 07/13] ppc440: Add busnum property to PCIe controller model

2023-07-03 Thread BALATON Zoltan
Instead of guessing controller number from dcrn_base add a property so the device does not need knowledge about where it is used. Signed-off-by: BALATON Zoltan --- hw/ppc/ppc440_uc.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git

[PATCH 02/13] ppc440: Add cpu link property to PCIe controller model

2023-07-03 Thread BALATON Zoltan
The PCIe controller model uses PPC DCRs but cannot be modeled with TYPE_PPC4xx_DCR_DEVICE as it derives from TYPE_PCIE_HOST_BRIDGE. Add a cpu link property to it similar to other DCR devices to allow registering DCRs from the device model. Signed-off-by: BALATON Zoltan --- hw/ppc/ppc440_uc.c |

[PATCH 04/13] ppc440: Rename local variable in dcr_read_pcie()

2023-07-03 Thread BALATON Zoltan
Rename local variable storing state struct in dcr_read_pcie() for brevity and consistency with other functions. Signed-off-by: BALATON Zoltan --- hw/ppc/ppc440_uc.c | 50 +++--- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git

[PATCH 12/13] ppc440_pcix: Don't use iomem for regs

2023-07-03 Thread BALATON Zoltan
The iomem memory region is better used for the PCI IO space but currently used for registers. Stop using it for that to allow this to be cleaned up in the next patch. Signed-off-by: BALATON Zoltan --- hw/ppc/ppc440_pcix.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git

[PATCH 03/13] ppc440: Add a macro to shorten PCIe controller DCR registration

2023-07-03 Thread BALATON Zoltan
It is more readable to wrap the complex call to ppc_dcr_register in a macro when needed repeatedly. Signed-off-by: BALATON Zoltan --- hw/ppc/ppc440_uc.c | 76 +- 1 file changed, 28 insertions(+), 48 deletions(-) diff --git a/hw/ppc/ppc440_uc.c

Re: [PATCH RESEND v2 1/2] target/i386/kvm: introduce 'pmu-cap-disabled' to set KVM_PMU_CAP_DISABLE

2023-07-03 Thread Dongli Zhang
Hi Like, On 7/2/23 06:41, Like Xu wrote: > On Wed, Jun 21, 2023 at 9:39 AM Dongli Zhang wrote: >> >> The "perf stat" at the VM side still works even we set "-cpu host,-pmu" in >> the QEMU command line. That is, neither "-cpu host,-pmu" nor "-cpu EPYC" >> could disable the pmu virtualization in

RE: [PATCH] Hexagon: move GETPC() calls to top level helpers

2023-07-03 Thread Brian Cain
> -Original Message- > From: Matheus Tavares Bernardino > Sent: Monday, July 3, 2023 4:50 PM > To: qemu-devel@nongnu.org > Cc: Brian Cain ; Marco Liebel (QUIC) > ; ltaylorsimp...@gmail.com > Subject: [PATCH] Hexagon: move GETPC() calls to top level helpers > > As

[PATCH] Hexagon: move GETPC() calls to top level helpers

2023-07-03 Thread Matheus Tavares Bernardino
As docs/devel/loads-stores.rst states: ``GETPC()`` should be used with great care: calling it in other functions that are *not* the top level ``HELPER(foo)`` will cause unexpected behavior. Instead, the value of ``GETPC()`` should be read from the helper and passed if needed to the

Re: [PATCH] riscv: Generate devicetree only after machine initialization is complete

2023-07-03 Thread Guenter Roeck
On 7/3/23 12:25, Daniel Henrique Barboza wrote: On 7/3/23 00:46, Guenter Roeck wrote: If the devicetree is created before machine initialization is complete, it misses dynamic devices. Specifically, the tpm device is not added to the devicetree file and is therefore not instantiated in Linux.

GLibC AMD CPUID cache reporting regression (was Re: qemu-user self emulation broken with default CPU on x86/x64)

2023-07-03 Thread Daniel P . Berrangé
On Mon, Jul 03, 2023 at 06:03:08PM +0200, Pierrick Bouvier wrote: > Hi everyone, > > Recently (in d135f781 [1], between v7.0.0 and v8.0.0), qemu-user default cpu > was updated to "max" instead of qemu32/qemu64. > > This change "broke" qemu self emulation if this new default cpu is used. > > $

Re: [PATCH v2] hw/ide/piix: properly initialize the BMIBA register

2023-07-03 Thread Bernhard Beschow
Am 3. Juli 2023 07:59:29 UTC schrieb Olaf Hering : >Sun, 02 Jul 2023 22:18:50 + Bernhard Beschow : > >> Do you know if that command calls pci_device_reset() (which would eventually >> call piix_ide_reset())? > >The function is pci_xen_ide_unplug, which calls device_cold_reset. I think

Re: [PATCH v2 1/2] linux-headers: Update with vfio_ap IRQ index mapping

2023-07-03 Thread Anthony Krowiak
On 7/3/23 12:31 PM, Cédric Le Goater wrote: On 6/2/23 16:11, Tony Krowiak wrote: Note: This is a placeholder patch that includes unmerged uapi changes. Signed-off-by: Tony Krowiak Link: https://lore.kernel.org/qemu-devel/20230530225544.280031-1-akrow...@linux.ibm.com/ I am preparing a

Re: [PATCH] riscv: Generate devicetree only after machine initialization is complete

2023-07-03 Thread Daniel Henrique Barboza
On 7/3/23 00:46, Guenter Roeck wrote: If the devicetree is created before machine initialization is complete, it misses dynamic devices. Specifically, the tpm device is not added to the devicetree file and is therefore not instantiated in Linux. Create devicetree in virt_machine_done() to solve

Re: [PATCH] riscv: Generate devicetree only after machine initialization is complete

2023-07-03 Thread Daniel Henrique Barboza
On 7/3/23 04:46, Philippe Mathieu-Daudé wrote: On 3/7/23 05:46, Guenter Roeck wrote: If the devicetree is created before machine initialization is complete, it misses dynamic devices. Specifically, the tpm device is not added to the devicetree file and is therefore not instantiated in Linux.

[PATCH v2 14/16] target/riscv: Move sysemu-specific code to sysemu/cpu_helper.c

2023-07-03 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/cpu_helper.c| 858 +- target/riscv/sysemu/cpu_helper.c | 863 +++ target/riscv/sysemu/meson.build | 1 + 3 files changed, 865 insertions(+), 857 deletions(-) create mode

[PATCH v2 12/16] target/riscv: Expose riscv_cpu_pending_to_irq() from cpu_helper.c

2023-07-03 Thread Philippe Mathieu-Daudé
We want to extract TCG/sysemu-specific code from cpu_helper.c, but some functions call riscv_cpu_pending_to_irq(). Expose the prototype in "internals.h". Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/internals.h | 4 target/riscv/cpu_helper.c | 6 +++--- 2 files changed, 7

[PATCH v2 15/16] target/riscv: Restrict TCG-specific prototype declarations

2023-07-03 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/cpu.h | 3 +++ target/riscv/cpu.c | 11 +++ 2 files changed, 14 insertions(+) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 42bd7efe4c..ab1968deb7 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -474,7

[PATCH v2 03/16] target/riscv: Restrict sysemu specific header to user emulation

2023-07-03 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique Barboza Acked-by: Alistair Francis --- target/riscv/cpu.c| 8 +--- target/riscv/cpu_helper.c | 2 ++ target/riscv/csr.c| 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git

[PATCH v2 04/16] target/riscv: Restrict 'rv128' machine to TCG accelerator

2023-07-03 Thread Philippe Mathieu-Daudé
We only build for 32/64-bit hosts, so TCG is required for 128-bit targets. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique Barboza Acked-by: Alistair Francis --- target/riscv/cpu.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git

[PATCH v2 01/16] target/riscv: Remove unuseful KVM stubs

2023-07-03 Thread Philippe Mathieu-Daudé
Since we always check whether KVM is enabled before calling kvm_riscv_reset_vcpu() and kvm_riscv_set_irq(), their call is elided by the compiler when KVM is not available. Therefore the stubs are not even linked. Remove them. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique

[PATCH v2 07/16] target/riscv: Move TCG-specific files to target/riscv/tcg/

2023-07-03 Thread Philippe Mathieu-Daudé
Move TCG-specific files to the a new 'tcg' sub-directory. Add stubs for riscv_cpu_[get/set]_fflags and riscv_raise_exception(). Adapt meson rules. Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/{ => tcg}/XVentanaCondOps.decode | 0 target/riscv/{ => tcg}/insn16.decode | 0

[PATCH v2 05/16] target/riscv: Move sysemu-specific files to target/riscv/sysemu/

2023-07-03 Thread Philippe Mathieu-Daudé
Move sysemu-specific files to the a new 'sysemu' sub-directory, adapt meson rules. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique Barboza Acked-by: Alistair Francis --- target/riscv/cpu.h | 2 +- target/riscv/{ => sysemu}/instmap.h| 0

[PATCH v2 09/16] target/riscv: Expose some 'trigger' prototypes from debug.c

2023-07-03 Thread Philippe Mathieu-Daudé
We want to extract TCG-specific code from debug.c, but some functions call get_trigger_type() / do_trigger_action(). Expose these prototypes in "debug.h". Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/debug.h | 4 target/riscv/debug.c | 5 ++--- 2 files changed, 6 insertions(+), 3

[PATCH v2 16/16] gitlab-ci.d/crossbuilds: Add KVM riscv64 cross-build jobs

2023-07-03 Thread Philippe Mathieu-Daudé
Add a new job to cross-build the riscv64 target without the TCG accelerator (IOW: only KVM accelerator enabled). Signed-off-by: Philippe Mathieu-Daudé --- .gitlab-ci.d/crossbuilds.yml | 8 1 file changed, 8 insertions(+) diff --git a/.gitlab-ci.d/crossbuilds.yml

[PATCH v2 08/16] target/riscv: Move TCG-specific cpu_get_tb_cpu_state() to tcg/cpu.c

2023-07-03 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/cpu_helper.c| 84 --- target/riscv/tcg/cpu.c | 98 target/riscv/tcg/meson.build | 1 + 3 files changed, 99 insertions(+), 84 deletions(-) create mode 100644

[PATCH v2 10/16] target/riscv: Extract TCG-specific code from debug.c

2023-07-03 Thread Philippe Mathieu-Daudé
Extract TCG-specific code from debug.c to tcg/sysemu/debug.c, restrict the prototypes to TCG, adapt meson rules. Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/debug.h| 2 + target/riscv/debug.c| 148 -

[RFC PATCH v2 13/16] target/riscv: Move TCG/sysemu-specific code to tcg/sysemu/cpu_helper.c

2023-07-03 Thread Philippe Mathieu-Daudé
Move TCG/sysemu-specific code and restrict the corresponding prototypes to TCG, adapting meson rules. Signed-off-by: Philippe Mathieu-Daudé --- RFC due to riscv_cpu_get_phys_page_debug() --- target/riscv/cpu.h | 15 +- target/riscv/cpu_helper.c| 745

[PATCH v2 11/16] target/riscv: Move sysemu-specific debug files to target/riscv/sysemu/

2023-07-03 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/cpu.h| 2 +- target/riscv/{ => sysemu}/debug.h | 0 target/riscv/cpu_helper.c | 2 +- target/riscv/{ => sysemu}/debug.c | 0 target/riscv/meson.build | 4 target/riscv/sysemu/meson.build | 1 + 6 files

[PATCH v2 06/16] target/riscv: Restrict riscv_cpu_do_interrupt() to sysemu

2023-07-03 Thread Philippe Mathieu-Daudé
riscv_cpu_do_interrupt() is not reachable on user emulation. Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/cpu.h| 5 +++-- target/riscv/cpu_helper.c | 7 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index

[PATCH v2 02/16] target/riscv: Remove unused 'instmap.h' header in translate.c

2023-07-03 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique Barboza Acked-by: Alistair Francis --- target/riscv/translate.c | 1 - 1 file changed, 1 deletion(-) diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 621dd99241..e3a6697cd8 100644 ---

[PATCH v2 00/16] target/riscv: Allow building without TCG (KVM-only so far)

2023-07-03 Thread Philippe Mathieu-Daudé
v2: Rebased on alistair23/riscv-to-apply.next Patch #1-#5 reviewed. Philippe Mathieu-Daudé (16): target/riscv: Remove unuseful KVM stubs target/riscv: Remove unused 'instmap.h' header in translate.c target/riscv: Restrict sysemu specific header to user emulation target/riscv: Restrict

Re: [RFC v3 05/10] linux-user: Implement native-bypass option support

2023-07-03 Thread Alex Bennée
Yeqi Fu writes: > This commit implements the -native-bypass support in linux-user. The > native_calls_enabled() function can be true only when the > '-native-bypass' option is given. > > Signed-off-by: Yeqi Fu > --- > linux-user/main.c | 36 > 1 file

Re: qemu-user self emulation broken with default CPU on x86/x64

2023-07-03 Thread Daniel P . Berrangé
On Mon, Jul 03, 2023 at 06:03:08PM +0200, Pierrick Bouvier wrote: > Hi everyone, > > Recently (in d135f781 [1], between v7.0.0 and v8.0.0), qemu-user default cpu > was updated to "max" instead of qemu32/qemu64. > > This change "broke" qemu self emulation if this new default cpu is used. > > $

Re: [PATCH] linux-user/syscall: Implement execve without execveat

2023-07-03 Thread Michael Tokarev
03.07.2023 18:48, Pierrick Bouvier пишет: Support for execveat syscall was implemented in 55bbe4 and is available since QEMU 8.0.0. It relies on host execveat, which is widely available on most of Linux kernels today. However, this change breaks qemu-user self emulation, if "host" qemu version

Re: [PATCH] vfio: Fix null pointer dereference bug in vfio_bars_finalize()

2023-07-03 Thread Philippe Mathieu-Daudé
On 3/7/23 18:39, Avihai Horon wrote: vfio_realize() has the following flow: 1. vfio_bars_prepare() -- sets VFIOBAR->size. 2. msix_early_setup(). 3. vfio_bars_register() -- allocates VFIOBAR->mr. After vfio_bars_prepare() is called msix_early_setup() can fail. If it does fail,

Re: [RFC v3 04/10] linux-user: Implement envlist_appendenv

2023-07-03 Thread Warner Losh
On Mon, Jul 3, 2023, 10:40 AM Alex Bennée wrote: > > Yeqi Fu writes: > > > Signed-off-by: Yeqi Fu > > --- > > include/qemu/envlist.h | 1 + > > util/envlist.c | 61 ++ > > 2 files changed, 62 insertions(+) > > > > diff --git

Re: [PATCH RFC 1/1] vdpa: Return -EINVAL if device's ack is VIRTIO_NET_ERR

2023-07-03 Thread Michael S. Tsirkin
On Wed, Jun 14, 2023 at 09:01:47PM +0800, Hawkins Jiawei wrote: > According to VirtIO standard, "The class, command and > command-specific-data are set by the driver, > and the device sets the ack byte. > There is little it can do except issue a diagnostic > if ack is not VIRTIO_NET_OK." > >

[PATCH] vfio: Fix null pointer dereference bug in vfio_bars_finalize()

2023-07-03 Thread Avihai Horon
vfio_realize() has the following flow: 1. vfio_bars_prepare() -- sets VFIOBAR->size. 2. msix_early_setup(). 3. vfio_bars_register() -- allocates VFIOBAR->mr. After vfio_bars_prepare() is called msix_early_setup() can fail. If it does fail, vfio_bars_register() is never called and VFIOBAR->mr is

Re: [RFC v3 04/10] linux-user: Implement envlist_appendenv

2023-07-03 Thread Alex Bennée
Yeqi Fu writes: > Signed-off-by: Yeqi Fu > --- > include/qemu/envlist.h | 1 + > util/envlist.c | 61 ++ > 2 files changed, 62 insertions(+) > > diff --git a/include/qemu/envlist.h b/include/qemu/envlist.h > index 6006dfae44..865eb18e17 100644

Re: [PATCH RFC 1/1] vdpa: Return -EINVAL if device's ack is VIRTIO_NET_ERR

2023-07-03 Thread Eugenio Perez Martin
On Wed, Jun 14, 2023 at 3:02 PM Hawkins Jiawei wrote: > > According to VirtIO standard, "The class, command and > command-specific-data are set by the driver, > and the device sets the ack byte. > There is little it can do except issue a diagnostic > if ack is not VIRTIO_NET_OK." > > Therefore,

Re: [RFC v3 03/10] build: Implement libnative library and configure options

2023-07-03 Thread Alex Bennée
Yeqi Fu writes: > This commit implements a shared library, where native functions are > rewritten as specialized instructions. At runtime, user programs load > the shared library, and specialized instructions are executed when > native functions are called. This commit breaks the build:

Re: [PATCH v4 00/10] tests/qtest: make migration-test massively faster

2023-07-03 Thread Thomas Huth
On 01/06/2023 18.13, Daniel P. Berrangé wrote: This makes migration-test faster by observing that most of the pre-copy tests don't need to be doing a live migration. They get sufficient code coverage with the guest CPUs paused. On my machine this cuts the overall execution time of

Re: [PATCH v2 1/2] linux-headers: Update with vfio_ap IRQ index mapping

2023-07-03 Thread Cédric Le Goater
On 6/2/23 16:11, Tony Krowiak wrote: Note: This is a placeholder patch that includes unmerged uapi changes. Signed-off-by: Tony Krowiak Link: https://lore.kernel.org/qemu-devel/20230530225544.280031-1-akrow...@linux.ibm.com/ I am preparing a vfio-next tree including these changes plus a

Re: [RFC PATCH 1/4] linux-headers: Update for vfio capability reporting AtomicOps

2023-07-03 Thread Cédric Le Goater
On 5/19/23 23:57, Alex Williamson wrote: This is a partial linux-headers update for illustrative and testing purposes only, NOT FOR COMMIT. Signed-off-by: Alex Williamson --- I am preparing a vfio-next tree including these changes plus a linux-headers update. I am just waiting for the 6.5-rc1

[PATCH] Fix SEGFAULT on getting physical address of MMIO region.

2023-07-03 Thread Mikhail Tyutin
The fix is to clear TLB_INVALID_MASK bit in tlb_addr, as it happens in other places e.g. load_helper(). Signed-off-by: Dmitriy Solovev Signed-off-by: Mikhail Tyutin --- accel/tcg/cputlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/cputlb.c

qemu-user self emulation broken with default CPU on x86/x64

2023-07-03 Thread Pierrick Bouvier
Hi everyone, Recently (in d135f781 [1], between v7.0.0 and v8.0.0), qemu-user default cpu was updated to "max" instead of qemu32/qemu64. This change "broke" qemu self emulation if this new default cpu is used. $ ./qemu-x86_64 ./qemu-x86_64 --version qemu-x86_64: ../util/cacheflush.c:212:

Re: [PATCH 05/24] linux-user: Split TARGET_PROT_* out of syscall_defs.h

2023-07-03 Thread Philippe Mathieu-Daudé
On 30/6/23 15:21, Richard Henderson wrote: Move the values into the per-target target_mman.h headers Signed-off-by: Richard Henderson --- linux-user/aarch64/target_mman.h | 3 +++ linux-user/generic/target_mman.h | 4 linux-user/mips/target_mman.h| 2 ++

[PATCH 07/12] target/s390x: Fix relative long instructions with large offsets

2023-07-03 Thread Ilya Leoshkevich
The expression "imm * 2" in gen_ri2() can wrap around if imm is large enough. Fix by casting imm to int64_t, like it's done in disas_jdest(). Fixes: e8ecdfeb30f0 ("Fix EXECUTE of relative branches") Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/translate.c | 2 +- 1 file changed, 1

[PATCH 03/12] target/s390x: Fix MDEB and MDEBR

2023-07-03 Thread Ilya Leoshkevich
These instructions multiply 32 bits by 32 bits, not 32 bits by 64 bits. Fixes: 83b00736f3d8 ("target-s390: Convert FP MULTIPLY") Cc: qemu-sta...@nongnu.org Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/fpu_helper.c| 3 ++- target/s390x/tcg/insn-data.h.inc | 4 ++-- 2 files changed, 4

[PATCH 08/12] tests/tcg/s390x: Test EPSW

2023-07-03 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 1 + tests/tcg/s390x/epsw.c | 23 +++ 2 files changed, 24 insertions(+) create mode 100644 tests/tcg/s390x/epsw.c diff --git

[PATCH 04/12] target/s390x: Fix MVCRL with a large value in R0

2023-07-03 Thread Ilya Leoshkevich
Using a large R0 causes an assertion error: qemu-s390x: target/s390x/tcg/mem_helper.c:183: access_prepare_nf: Assertion `size > 0 && size <= 4096' failed. Even though PoP explicitly advises against using more than 8 bits for the size, an emulator crash is never a good thing. Fix by

[PATCH 09/12] tests/tcg/s390x: Test LARL with a large offset

2023-07-03 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 1 + tests/tcg/s390x/larl.c | 17 + 2 files changed, 18 insertions(+) create mode 100644 tests/tcg/s390x/larl.c diff --git a/tests/tcg/s390x/Makefile.target

[PATCH 05/12] target/s390x: Fix LRA overwriting the top 32 bits on DAT error

2023-07-03 Thread Ilya Leoshkevich
When a DAT error occurs, LRA is supposed to write the error information to the bottom 32 bits of R1, and leave the top 32 bits of R1 alone. Fix by passing the original value of R1 into helper and copying the top 32 bits to the return value. Fixes: d8fe4a9c284f ("target-s390: Convert LRA") Cc:

[PATCH 12/12] tests/tcg/s390x: Test MVCRL with a large value in R0

2023-07-03 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/mie3-mvcrl.c | 46 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/tests/tcg/s390x/mie3-mvcrl.c b/tests/tcg/s390x/mie3-mvcrl.c index

[PATCH 00/12] target/s390x: Miscellaneous TCG fixes

2023-07-03 Thread Ilya Leoshkevich
Hi, Randomized testing found a number of issues in the s390x emulation. This series fixes 6 of them (patches 2-7) and adds tests (patches 8-12); patch 1 is a cosmetic improvement needed for the EPSW test. There are more issues, but I thought it would be better to send this batch now. Best

[PATCH 02/12] target/s390x: Fix EPSW CC reporting

2023-07-03 Thread Ilya Leoshkevich
EPSW should explicitly calculate and insert CC, like IPM does. Fixes: e30a9d3fea58 ("target-s390: Implement EPSW") Cc: qemu-sta...@nongnu.org Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/translate.c | 4 1 file changed, 4 insertions(+) diff --git a/target/s390x/tcg/translate.c

[PATCH 01/12] linux-user: elfload: Add more initial s390x PSW bits

2023-07-03 Thread Ilya Leoshkevich
Make the PSW look more similar to the real s390x userspace PSW. Except for being there, the newly added bits should not affect the userspace code execution. Signed-off-by: Ilya Leoshkevich --- linux-user/elfload.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git

[PATCH 11/12] tests/tcg/s390x: Test MDEB and MDEBR

2023-07-03 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 1 + tests/tcg/s390x/mdeb.c | 30 ++ 2 files changed, 31 insertions(+) create mode 100644 tests/tcg/s390x/mdeb.c diff --git

[PATCH 06/12] target/s390x: Fix LRA when DAT is off

2023-07-03 Thread Ilya Leoshkevich
LRA should perform DAT regardless of whether it's on or off. Disable DAT check for MMU_S390_LRA. Fixes: defb0e3157af ("s390x: Implement opcode helpers") Cc: qemu-sta...@nongnu.org Signed-off-by: Ilya Leoshkevich --- target/s390x/mmu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

[PATCH 10/12] tests/tcg/s390x: Test LRA

2023-07-03 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/lra.S | 19 +++ 2 files changed, 20 insertions(+) create mode 100644 tests/tcg/s390x/lra.S diff --git

Re: [PATCH 01/24] linux-user: Use assert in mmap_fork_start

2023-07-03 Thread Philippe Mathieu-Daudé
On 30/6/23 15:21, Richard Henderson wrote: Assert is preferred over if+abort for the error message. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH 02/24] linux-user: Fix formatting of mmap.c

2023-07-03 Thread Philippe Mathieu-Daudé
On 30/6/23 15:21, Richard Henderson wrote: Fix all checkpatch.pl errors within mmap.c. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 199 -- 1 file changed, 122 insertions(+), 77 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH v2] target/riscv: Optimize ambiguous local variable in pmp_hart_has_privs

2023-07-03 Thread Philippe Mathieu-Daudé
On 3/7/23 16:03, Ruibo Lu wrote: These two values represents whether start/end address is in pmp_range. However, the type and name of them is ambiguous. This commit change the name and type of them to improve code readability and accuracy. Signed-off-by: Ruibo Lu --- target/riscv/pmp.c | 20

Re: [PATCH] MAINTAINERS: raise status of 9p to 'Maintained'

2023-07-03 Thread Philippe Mathieu-Daudé
On 3/7/23 16:34, Christian Schoenebeck wrote: Change status of 9p from 'Odd Fixes' to 'Maintained', as this better reflects current situation. I already take care of 9p patches for a while, which included new features as well. Based-on: Signed-off-by: Christian Schoenebeck --- MAINTAINERS |

[PATCH] linux-user/syscall: Implement execve without execveat

2023-07-03 Thread Pierrick Bouvier
Support for execveat syscall was implemented in 55bbe4 and is available since QEMU 8.0.0. It relies on host execveat, which is widely available on most of Linux kernels today. However, this change breaks qemu-user self emulation, if "host" qemu version is less than 8.0.0. Indeed, it does not

Re: [PATCH v6 5/7] vfio/migration: Free resources when vfio_migration_realize fails

2023-07-03 Thread Cédric Le Goater
On 7/3/23 09:15, Zhenzhong Duan wrote: When vfio_realize() succeeds, hot unplug will call vfio_exitfn() to free resources allocated in vfio_realize(); when vfio_realize() fails, vfio_exitfn() is never called and we need to free resources in vfio_realize(). In the case that

Re: [PATCH v6 5/7] vfio/migration: Free resources when vfio_migration_realize fails

2023-07-03 Thread Cédric Le Goater
On 7/3/23 17:34, Avihai Horon wrote: On 03/07/2023 10:15, Zhenzhong Duan wrote: External email: Use caution opening links or attachments When vfio_realize() succeeds, hot unplug will call vfio_exitfn() to free resources allocated in vfio_realize(); when vfio_realize() fails, vfio_exitfn() is

Re: [PATCH v6 5/7] vfio/migration: Free resources when vfio_migration_realize fails

2023-07-03 Thread Avihai Horon
On 03/07/2023 10:15, Zhenzhong Duan wrote: External email: Use caution opening links or attachments When vfio_realize() succeeds, hot unplug will call vfio_exitfn() to free resources allocated in vfio_realize(); when vfio_realize() fails, vfio_exitfn() is never called and we need to free

Re: [RFC v3 02/10] build: Add configure options for native calls

2023-07-03 Thread Alex Bennée
Yeqi Fu writes: > Add CONFIG_NATIVE_CALL to architectures supporting native calls. > > Signed-off-by: Yeqi Fu I would expect this patch to be split up and merged with the enabling patch for each architecture. > --- > configs/targets/aarch64-linux-user.mak | 1 + >

Re: [PATCH v6 7/7] vfio/migration: Return bool type for vfio_migration_realize()

2023-07-03 Thread Joao Martins
On 03/07/2023 08:15, Zhenzhong Duan wrote: > Make vfio_migration_realize() adhere to the convention of other realize() > callbacks(like qdev_realize) by returning bool instead of int. > > Suggested-by: Cédric Le Goater > Suggested-by: Joao Martins > Signed-off-by: Zhenzhong Duan

  1   2   3   4   >