qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 00/15] Misc HW patches for 2024-04-02
@ 2024-04-02 14:24 Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 01/15] accel/tcg/plugin: Remove CONFIG_SOFTMMU_GATE definition Philippe Mathieu-Daudé
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-02 14:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, qemu-block, qemu-arm, Philippe Mathieu-Daudé

The following changes since commit 7fcf7575f3d201fc84ae168017ffdfd6c86257a6:

  Merge tag 'pull-target-arm-20240402' of https://git.linaro.org/people/pmaydell/qemu-arm into staging (2024-04-02 11:34:49 +0100)

are available in the Git repository at:

  https://github.com/philmd/qemu.git tags/hw-misc-20240402

for you to fetch changes up to 4c54f5bc8e1d38f15cc35b6a6932d8fbe219c692:

  hw/net/virtio-net: fix qemu set used ring flag even vhost started (2024-04-02 16:15:07 +0200)

----------------------------------------------------------------
Misc HW patch queue

- MAINTAINERS updates (Zhao, Glenn)
- Replace incorrect mentions of 'softmmu' by 'system' (Phil)
- Avoid using inlined functions with external linkage (Phil)
- Restrict CXL to x86 PC PCI-based machines (Phil)
- Remove unnecessary NULL check in bdrv_pad_request (Kevin)
- Fix a pair of -Werror=maybe-uninitialized (Marc-André)
- Initialize variable in xen_evtchn_soft_reset (Artem)
- Do not access virtio-net tx queue until vhost is started (Yajun)

----------------------------------------------------------------

Artem Chernyshev (1):
  hw/xen_evtchn: Initialize flush_kvm_routes

Glenn Miles (1):
  gpio/pca955x: Update maintainer email address

Kevin Wolf (1):
  block: Remove unnecessary NULL check in bdrv_pad_request()

Marc-André Lureau (2):
  plugins: fix -Werror=maybe-uninitialized false-positive
  hw/nvme: fix -Werror=maybe-uninitialized

Philippe Mathieu-Daudé (8):
  accel/tcg/plugin: Remove CONFIG_SOFTMMU_GATE definition
  gdbstub: Correct invalid mentions of 'softmmu' by 'system'
  gdbstub/system: Rename 'user_ctx' argument as 'ctx'
  target/ppc: Rename init_excp_4xx_softmmu() -> init_excp_4xx()
  hw/arm/smmu: Avoid using inlined functions with external linkage again
  accel/hvf: Un-inline hvf_arch_supports_guest_debug()
  qtest/libqos: Reduce size_to_prdtl() declaration scope
  hw/i386/pc: Restrict CXL to PCI-based machines

Yajun Wu (1):
  hw/net/virtio-net: fix qemu set used ring flag even vhost started

Zhao Liu (1):
  MAINTAINERS: Fix error-report.c entry

 MAINTAINERS               |  4 ++--
 gdbstub/internals.h       | 26 +++++++++++++-------------
 tests/qtest/libqos/ahci.h |  1 -
 accel/tcg/plugin-gen.c    |  6 ------
 block/io.c                |  2 +-
 gdbstub/system.c          | 10 +++++-----
 hw/arm/smmu-common.c      |  2 +-
 hw/i386/kvm/xen_evtchn.c  |  2 +-
 hw/i386/pc.c              |  4 +++-
 hw/net/virtio-net.c       |  4 ++++
 hw/nvme/ctrl.c            |  2 +-
 plugins/loader.c          |  2 +-
 target/arm/hvf/hvf.c      |  2 +-
 target/i386/hvf/hvf.c     |  2 +-
 target/ppc/cpu_init.c     |  4 ++--
 tests/qtest/libqos/ahci.c |  2 +-
 16 files changed, 37 insertions(+), 38 deletions(-)

-- 
2.41.0



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PULL 01/15] accel/tcg/plugin: Remove CONFIG_SOFTMMU_GATE definition
  2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
@ 2024-04-02 14:24 ` Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 02/15] gdbstub: Correct invalid mentions of 'softmmu' by 'system' Philippe Mathieu-Daudé
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-02 14:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, qemu-block, qemu-arm, Philippe Mathieu-Daudé,
	Thomas Huth, Richard Henderson, Paolo Bonzini

The CONFIG_SOFTMMU_GATE definition was never used, remove it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240313213339.82071-2-philmd@linaro.org>
---
 accel/tcg/plugin-gen.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c
index 8028786c7b..cd78ef94a1 100644
--- a/accel/tcg/plugin-gen.c
+++ b/accel/tcg/plugin-gen.c
@@ -57,12 +57,6 @@
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
-#ifdef CONFIG_SOFTMMU
-# define CONFIG_SOFTMMU_GATE 1
-#else
-# define CONFIG_SOFTMMU_GATE 0
-#endif
-
 /*
  * plugin_cb_start TCG op args[]:
  * 0: enum plugin_gen_from
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PULL 02/15] gdbstub: Correct invalid mentions of 'softmmu' by 'system'
  2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 01/15] accel/tcg/plugin: Remove CONFIG_SOFTMMU_GATE definition Philippe Mathieu-Daudé
@ 2024-04-02 14:24 ` Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 03/15] gdbstub/system: Rename 'user_ctx' argument as 'ctx' Philippe Mathieu-Daudé
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-02 14:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, qemu-block, qemu-arm, Philippe Mathieu-Daudé,
	Thomas Huth, Richard Henderson, Alex Bennée

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240313213339.82071-3-philmd@linaro.org>
---
 gdbstub/internals.h | 20 ++++++++++----------
 gdbstub/system.c    |  2 +-
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/gdbstub/internals.h b/gdbstub/internals.h
index e83b179920..66c939c67f 100644
--- a/gdbstub/internals.h
+++ b/gdbstub/internals.h
@@ -115,7 +115,7 @@ void gdb_read_byte(uint8_t ch);
 
 /*
  * Packet acknowledgement - we handle this slightly differently
- * between user and softmmu mode, mainly to deal with the differences
+ * between user and system mode, mainly to deal with the differences
  * between the flexible chardev and the direct fd approaches.
  *
  * We currently don't support a negotiated QStartNoAckMode
@@ -125,7 +125,7 @@ void gdb_read_byte(uint8_t ch);
  * gdb_got_immediate_ack() - check ok to continue
  *
  * Returns true to continue, false to re-transmit for user only, the
- * softmmu stub always returns true.
+ * system stub always returns true.
  */
 bool gdb_got_immediate_ack(void);
 /* utility helpers */
@@ -135,12 +135,12 @@ CPUState *gdb_first_attached_cpu(void);
 void gdb_append_thread_id(CPUState *cpu, GString *buf);
 int gdb_get_cpu_index(CPUState *cpu);
 unsigned int gdb_get_max_cpus(void); /* both */
-bool gdb_can_reverse(void); /* softmmu, stub for user */
+bool gdb_can_reverse(void); /* system emulation, stub for user */
 int gdb_target_sigtrap(void); /* user */
 
 void gdb_create_default_process(GDBState *s);
 
-/* signal mapping, common for softmmu, specialised for user-mode */
+/* signal mapping, common for system, specialised for user-mode */
 int gdb_signal_to_target(int sig);
 int gdb_target_signal_to_gdb(int sig);
 
@@ -157,12 +157,12 @@ void gdb_continue(void);
 int gdb_continue_partial(char *newstates);
 
 /*
- * Helpers with separate softmmu and user implementations
+ * Helpers with separate system and user implementations
  */
 void gdb_put_buffer(const uint8_t *buf, int len);
 
 /*
- * Command handlers - either specialised or softmmu or user only
+ * Command handlers - either specialised or system or user only
  */
 void gdb_init_gdbserver_state(void);
 
@@ -187,7 +187,7 @@ typedef union GdbCmdVariant {
 
 #define get_param(p, i)    (&g_array_index(p, GdbCmdVariant, i))
 
-void gdb_handle_query_rcmd(GArray *params, void *user_ctx); /* softmmu */
+void gdb_handle_query_rcmd(GArray *params, void *user_ctx); /* system */
 void gdb_handle_query_offsets(GArray *params, void *user_ctx); /* user */
 void gdb_handle_query_xfer_auxv(GArray *params, void *user_ctx); /*user */
 void gdb_handle_query_xfer_siginfo(GArray *params, void *user_ctx); /*user */
@@ -203,7 +203,7 @@ bool gdb_handle_detach_user(uint32_t pid); /* user */
 
 void gdb_handle_query_attached(GArray *params, void *user_ctx); /* both */
 
-/* softmmu only */
+/* system only */
 void gdb_handle_query_qemu_phy_mem_mode(GArray *params, void *user_ctx);
 void gdb_handle_set_qemu_phy_mem_mode(GArray *params, void *user_ctx);
 
@@ -213,11 +213,11 @@ bool gdb_handled_syscall(void);
 void gdb_disable_syscalls(void);
 void gdb_syscall_reset(void);
 
-/* user/softmmu specific syscall handling */
+/* user/system specific syscall handling */
 void gdb_syscall_handling(const char *syscall_packet);
 
 /*
- * Break/Watch point support - there is an implementation for softmmu
+ * Break/Watch point support - there is an implementation for system
  * and user mode.
  */
 bool gdb_supports_guest_debug(void);
diff --git a/gdbstub/system.c b/gdbstub/system.c
index 83fd452800..a3ce384cd1 100644
--- a/gdbstub/system.c
+++ b/gdbstub/system.c
@@ -1,5 +1,5 @@
 /*
- * gdb server stub - softmmu specific bits
+ * gdb server stub - system specific bits
  *
  * Debug integration depends on support from the individual
  * accelerators so most of this involves calling the ops helpers.
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PULL 03/15] gdbstub/system: Rename 'user_ctx' argument as 'ctx'
  2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 01/15] accel/tcg/plugin: Remove CONFIG_SOFTMMU_GATE definition Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 02/15] gdbstub: Correct invalid mentions of 'softmmu' by 'system' Philippe Mathieu-Daudé
@ 2024-04-02 14:24 ` Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 04/15] target/ppc: Rename init_excp_4xx_softmmu() -> init_excp_4xx() Philippe Mathieu-Daudé
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-02 14:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, qemu-block, qemu-arm, Philippe Mathieu-Daudé,
	Richard Henderson, Alex Bennée

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240313213339.82071-4-philmd@linaro.org>
---
 gdbstub/internals.h | 8 ++++----
 gdbstub/system.c    | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/gdbstub/internals.h b/gdbstub/internals.h
index 66c939c67f..32f9f63297 100644
--- a/gdbstub/internals.h
+++ b/gdbstub/internals.h
@@ -187,7 +187,7 @@ typedef union GdbCmdVariant {
 
 #define get_param(p, i)    (&g_array_index(p, GdbCmdVariant, i))
 
-void gdb_handle_query_rcmd(GArray *params, void *user_ctx); /* system */
+void gdb_handle_query_rcmd(GArray *params, void *ctx); /* system */
 void gdb_handle_query_offsets(GArray *params, void *user_ctx); /* user */
 void gdb_handle_query_xfer_auxv(GArray *params, void *user_ctx); /*user */
 void gdb_handle_query_xfer_siginfo(GArray *params, void *user_ctx); /*user */
@@ -201,11 +201,11 @@ void gdb_handle_query_supported_user(const char *gdb_supported); /* user */
 bool gdb_handle_set_thread_user(uint32_t pid, uint32_t tid); /* user */
 bool gdb_handle_detach_user(uint32_t pid); /* user */
 
-void gdb_handle_query_attached(GArray *params, void *user_ctx); /* both */
+void gdb_handle_query_attached(GArray *params, void *ctx); /* both */
 
 /* system only */
-void gdb_handle_query_qemu_phy_mem_mode(GArray *params, void *user_ctx);
-void gdb_handle_set_qemu_phy_mem_mode(GArray *params, void *user_ctx);
+void gdb_handle_query_qemu_phy_mem_mode(GArray *params, void *ctx);
+void gdb_handle_set_qemu_phy_mem_mode(GArray *params, void *ctx);
 
 /* sycall handling */
 void gdb_handle_file_io(GArray *params, void *user_ctx);
diff --git a/gdbstub/system.c b/gdbstub/system.c
index a3ce384cd1..d235403855 100644
--- a/gdbstub/system.c
+++ b/gdbstub/system.c
@@ -488,13 +488,13 @@ bool gdb_can_reverse(void)
  */
 
 void gdb_handle_query_qemu_phy_mem_mode(GArray *params,
-                                        void *user_ctx)
+                                        void *ctx)
 {
     g_string_printf(gdbserver_state.str_buf, "%d", phy_memory_mode);
     gdb_put_strbuf();
 }
 
-void gdb_handle_set_qemu_phy_mem_mode(GArray *params, void *user_ctx)
+void gdb_handle_set_qemu_phy_mem_mode(GArray *params, void *ctx)
 {
     if (!params->len) {
         gdb_put_packet("E22");
@@ -509,7 +509,7 @@ void gdb_handle_set_qemu_phy_mem_mode(GArray *params, void *user_ctx)
     gdb_put_packet("OK");
 }
 
-void gdb_handle_query_rcmd(GArray *params, void *user_ctx)
+void gdb_handle_query_rcmd(GArray *params, void *ctx)
 {
     const guint8 zero = 0;
     int len;
@@ -539,7 +539,7 @@ void gdb_handle_query_rcmd(GArray *params, void *user_ctx)
  * Execution state helpers
  */
 
-void gdb_handle_query_attached(GArray *params, void *user_ctx)
+void gdb_handle_query_attached(GArray *params, void *ctx)
 {
     gdb_put_packet("1");
 }
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PULL 04/15] target/ppc: Rename init_excp_4xx_softmmu() -> init_excp_4xx()
  2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2024-04-02 14:24 ` [PULL 03/15] gdbstub/system: Rename 'user_ctx' argument as 'ctx' Philippe Mathieu-Daudé
@ 2024-04-02 14:24 ` Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 05/15] hw/arm/smmu: Avoid using inlined functions with external linkage again Philippe Mathieu-Daudé
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-02 14:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, qemu-block, qemu-arm, Philippe Mathieu-Daudé,
	Nicholas Piggin, Daniel Henrique Barboza

Unify with other init_excp_FOO() in the same file.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Nicholas Piggin <npiggin@gmail.com>
Message-Id: <20240313213339.82071-5-philmd@linaro.org>
---
 target/ppc/cpu_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index 22fdea093b..6241de62ce 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -1642,7 +1642,7 @@ static void register_8xx_sprs(CPUPPCState *env)
 
 /*****************************************************************************/
 /* Exception vectors models                                                  */
-static void init_excp_4xx_softmmu(CPUPPCState *env)
+static void init_excp_4xx(CPUPPCState *env)
 {
 #if !defined(CONFIG_USER_ONLY)
     env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000100;
@@ -2120,7 +2120,7 @@ static void init_proc_405(CPUPPCState *env)
     env->id_tlbs = 0;
     env->tlb_type = TLB_EMB;
 #endif
-    init_excp_4xx_softmmu(env);
+    init_excp_4xx(env);
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PULL 05/15] hw/arm/smmu: Avoid using inlined functions with external linkage again
  2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2024-04-02 14:24 ` [PULL 04/15] target/ppc: Rename init_excp_4xx_softmmu() -> init_excp_4xx() Philippe Mathieu-Daudé
@ 2024-04-02 14:24 ` Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 06/15] accel/hvf: Un-inline hvf_arch_supports_guest_debug() Philippe Mathieu-Daudé
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-02 14:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, qemu-block, qemu-arm, Philippe Mathieu-Daudé,
	Richard Henderson, Eric Auger, Peter Maydell

Similarly to commit 9de9fa5cf2 ("hw/arm/smmu-common: Avoid using
inlined functions with external linkage"):

  None of our code base require / use inlined functions with external
  linkage. Some places use internal inlining in the hot path. These
  two functions are certainly not in any hot path and don't justify
  any inlining, so these are likely oversights rather than intentional.

Fix:

  C compiler for the host machine: clang (clang 15.0.0 "Apple clang version 15.0.0 (clang-1500.3.9.4)")
  ...
  hw/arm/smmu-common.c:203:43: error: static function 'smmu_hash_remove_by_vmid' is
  used in an inline function with external linkage [-Werror,-Wstatic-in-inline]
      g_hash_table_foreach_remove(s->iotlb, smmu_hash_remove_by_vmid, &vmid);
                                            ^
  include/hw/arm/smmu-common.h:197:1: note: use 'static' to give inline function 'smmu_iotlb_inv_vmid' internal linkage
  void smmu_iotlb_inv_vmid(SMMUState *s, uint16_t vmid);
  ^
  static
  hw/arm/smmu-common.c:139:17: note: 'smmu_hash_remove_by_vmid' declared here
  static gboolean smmu_hash_remove_by_vmid(gpointer key, gpointer value,
                ^

Fixes: ccc3ee3871 ("hw/arm/smmuv3: Add CMDs related to stage-2")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-Id: <20240313184954.42513-2-philmd@linaro.org>
---
 hw/arm/smmu-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
index 4caedb4998..c4b540656c 100644
--- a/hw/arm/smmu-common.c
+++ b/hw/arm/smmu-common.c
@@ -197,7 +197,7 @@ void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid)
     g_hash_table_foreach_remove(s->iotlb, smmu_hash_remove_by_asid, &asid);
 }
 
-inline void smmu_iotlb_inv_vmid(SMMUState *s, uint16_t vmid)
+void smmu_iotlb_inv_vmid(SMMUState *s, uint16_t vmid)
 {
     trace_smmu_iotlb_inv_vmid(vmid);
     g_hash_table_foreach_remove(s->iotlb, smmu_hash_remove_by_vmid, &vmid);
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PULL 06/15] accel/hvf: Un-inline hvf_arch_supports_guest_debug()
  2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2024-04-02 14:24 ` [PULL 05/15] hw/arm/smmu: Avoid using inlined functions with external linkage again Philippe Mathieu-Daudé
@ 2024-04-02 14:24 ` Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 07/15] qtest/libqos: Reduce size_to_prdtl() declaration scope Philippe Mathieu-Daudé
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-02 14:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, qemu-block, qemu-arm, Philippe Mathieu-Daudé,
	Peter Maydell, Richard Henderson, Alexander Graf,
	Cameron Esfahani, Roman Bolshakov

See previous commit and commit 9de9fa5cf2 ("Avoid using inlined
functions with external linkage") for rationale.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240313184954.42513-3-philmd@linaro.org>
---
 target/arm/hvf/hvf.c  | 2 +-
 target/i386/hvf/hvf.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index e5f0f60093..65a5601804 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -2246,7 +2246,7 @@ void hvf_arch_update_guest_debug(CPUState *cpu)
     hvf_arch_set_traps();
 }
 
-inline bool hvf_arch_supports_guest_debug(void)
+bool hvf_arch_supports_guest_debug(void)
 {
     return true;
 }
diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
index 11ffdd4c69..1ed8ed5154 100644
--- a/target/i386/hvf/hvf.c
+++ b/target/i386/hvf/hvf.c
@@ -708,7 +708,7 @@ void hvf_arch_update_guest_debug(CPUState *cpu)
 {
 }
 
-inline bool hvf_arch_supports_guest_debug(void)
+bool hvf_arch_supports_guest_debug(void)
 {
     return false;
 }
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PULL 07/15] qtest/libqos: Reduce size_to_prdtl() declaration scope
  2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2024-04-02 14:24 ` [PULL 06/15] accel/hvf: Un-inline hvf_arch_supports_guest_debug() Philippe Mathieu-Daudé
@ 2024-04-02 14:24 ` Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 08/15] MAINTAINERS: Fix error-report.c entry Philippe Mathieu-Daudé
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-02 14:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, qemu-block, qemu-arm, Philippe Mathieu-Daudé,
	Peter Maydell, Thomas Huth, John Snow, Laurent Vivier,
	Paolo Bonzini

Since size_to_prdtl() is only used within ahci.c,
declare it statically. This removes the last use
of "inlined function with external linkage". See
previous commit and commit 9de9fa5cf2 for rationale.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20240326171009.26696-4-philmd@linaro.org>
---
 tests/qtest/libqos/ahci.h | 1 -
 tests/qtest/libqos/ahci.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/qtest/libqos/ahci.h b/tests/qtest/libqos/ahci.h
index 48017864bf..a0487a1557 100644
--- a/tests/qtest/libqos/ahci.h
+++ b/tests/qtest/libqos/ahci.h
@@ -599,7 +599,6 @@ void ahci_port_check_cmd_sanity(AHCIQState *ahci, AHCICommand *cmd);
 
 /* Misc */
 bool is_atapi(AHCIQState *ahci, uint8_t port);
-unsigned size_to_prdtl(unsigned bytes, unsigned bytes_per_prd);
 
 /* Command: Macro level execution */
 void ahci_guest_io(AHCIQState *ahci, uint8_t port, uint8_t ide_cmd,
diff --git a/tests/qtest/libqos/ahci.c b/tests/qtest/libqos/ahci.c
index a2c94c6e06..6d59c7551a 100644
--- a/tests/qtest/libqos/ahci.c
+++ b/tests/qtest/libqos/ahci.c
@@ -662,7 +662,7 @@ unsigned ahci_pick_cmd(AHCIQState *ahci, uint8_t port)
     g_assert_not_reached();
 }
 
-inline unsigned size_to_prdtl(unsigned bytes, unsigned bytes_per_prd)
+static unsigned size_to_prdtl(unsigned bytes, unsigned bytes_per_prd)
 {
     /* Each PRD can describe up to 4MiB */
     g_assert_cmphex(bytes_per_prd, <=, 4096 * 1024);
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PULL 08/15] MAINTAINERS: Fix error-report.c entry
  2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  2024-04-02 14:24 ` [PULL 07/15] qtest/libqos: Reduce size_to_prdtl() declaration scope Philippe Mathieu-Daudé
@ 2024-04-02 14:24 ` Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 09/15] hw/i386/pc: Restrict CXL to PCI-based machines Philippe Mathieu-Daudé
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-02 14:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, qemu-block, qemu-arm, Zhao Liu,
	Philippe Mathieu-Daudé

From: Zhao Liu <zhao1.liu@intel.com>

The commit 15002f60f792 ("util: rename qemu-error.c to match its header
name") renamed util/qemu-error.c to util/error-report.c but missed to
change the corresponding entry.

To avoid get_maintainer.pl failing, update the error-report.c entry.

Fixes: 15002f60f7 ("util: rename qemu-error.c to match its header name")
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240327115539.3860270-1-zhao1.liu@linux.intel.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index a07af6b9d4..197a06b42f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3013,7 +3013,7 @@ F: include/qapi/error.h
 F: include/qemu/error-report.h
 F: qapi/error.json
 F: util/error.c
-F: util/qemu-error.c
+F: util/error-report.c
 F: scripts/coccinelle/err-bad-newline.cocci
 F: scripts/coccinelle/error-use-after-free.cocci
 F: scripts/coccinelle/error_propagate_null.cocci
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PULL 09/15] hw/i386/pc: Restrict CXL to PCI-based machines
  2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
                   ` (7 preceding siblings ...)
  2024-04-02 14:24 ` [PULL 08/15] MAINTAINERS: Fix error-report.c entry Philippe Mathieu-Daudé
@ 2024-04-02 14:24 ` Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 10/15] block: Remove unnecessary NULL check in bdrv_pad_request() Philippe Mathieu-Daudé
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-02 14:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, qemu-block, qemu-arm, Philippe Mathieu-Daudé,
	Jonathan Cameron, Paolo Bonzini, Richard Henderson,
	Eduardo Habkost, Michael S. Tsirkin, Marcel Apfelbaum

CXL is based on PCIe. In is pointless to initialize
its context on non-PCI machines.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-ID: <20240327161642.33574-1-philmd@linaro.org>
---
 hw/i386/pc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index e80f02bef4..5c21b0c4db 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1738,7 +1738,9 @@ static void pc_machine_initfn(Object *obj)
     pcms->pcspk = isa_new(TYPE_PC_SPEAKER);
     object_property_add_alias(OBJECT(pcms), "pcspk-audiodev",
                               OBJECT(pcms->pcspk), "audiodev");
-    cxl_machine_init(obj, &pcms->cxl_devices_state);
+    if (pcmc->pci_enabled) {
+        cxl_machine_init(obj, &pcms->cxl_devices_state);
+    }
 
     pcms->machine_done.notify = pc_machine_done;
     qemu_add_machine_init_done_notifier(&pcms->machine_done);
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PULL 10/15] block: Remove unnecessary NULL check in bdrv_pad_request()
  2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
                   ` (8 preceding siblings ...)
  2024-04-02 14:24 ` [PULL 09/15] hw/i386/pc: Restrict CXL to PCI-based machines Philippe Mathieu-Daudé
@ 2024-04-02 14:24 ` Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 11/15] plugins: fix -Werror=maybe-uninitialized false-positive Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-02 14:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, qemu-block, qemu-arm, Kevin Wolf,
	Philippe Mathieu-Daudé, Fiona Ebner, Stefan Hajnoczi,
	Fam Zheng, Hanna Reitz

From: Kevin Wolf <kwolf@redhat.com>

Coverity complains that the check introduced in commit 3f934817 suggests
that qiov could be NULL and we dereference it before reaching the check.
In fact, all of the callers pass a non-NULL pointer, so just remove the
misleading check.

Resolves: Coverity CID 1542668
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Message-ID: <20240327192750.204197-1-kwolf@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 block/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/io.c b/block/io.c
index 395bea3bac..7217cf811b 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1730,7 +1730,7 @@ static int bdrv_pad_request(BlockDriverState *bs,
      * For prefetching in stream_populate(), no qiov is passed along, because
      * only copy-on-read matters.
      */
-    if (qiov && *qiov) {
+    if (*qiov) {
         sliced_iov = qemu_iovec_slice(*qiov, *qiov_offset, *bytes,
                                       &sliced_head, &sliced_tail,
                                       &sliced_niov);
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PULL 11/15] plugins: fix -Werror=maybe-uninitialized false-positive
  2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
                   ` (9 preceding siblings ...)
  2024-04-02 14:24 ` [PULL 10/15] block: Remove unnecessary NULL check in bdrv_pad_request() Philippe Mathieu-Daudé
@ 2024-04-02 14:24 ` Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 12/15] hw/nvme: fix -Werror=maybe-uninitialized Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-02 14:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, qemu-block, qemu-arm, Marc-André Lureau,
	Pierrick Bouvier, Philippe Mathieu-Daudé, Alex Bennée,
	Alexandre Iooss, Mahmoud Mandour

From: Marc-André Lureau <marcandre.lureau@redhat.com>

../plugins/loader.c:405:15: error: ‘ctx’ may be used uninitialized [-Werror=maybe-uninitialized]

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-ID: <20240328102052.3499331-15-marcandre.lureau@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 plugins/loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/loader.c b/plugins/loader.c
index 9768b78eb6..513a429c57 100644
--- a/plugins/loader.c
+++ b/plugins/loader.c
@@ -390,7 +390,7 @@ void plugin_reset_uninstall(qemu_plugin_id_t id,
                             bool reset)
 {
     struct qemu_plugin_reset_data *data;
-    struct qemu_plugin_ctx *ctx;
+    struct qemu_plugin_ctx *ctx = NULL;
 
     WITH_QEMU_LOCK_GUARD(&plugin.lock) {
         ctx = plugin_id_to_ctx_locked(id);
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PULL 12/15] hw/nvme: fix -Werror=maybe-uninitialized
  2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
                   ` (10 preceding siblings ...)
  2024-04-02 14:24 ` [PULL 11/15] plugins: fix -Werror=maybe-uninitialized false-positive Philippe Mathieu-Daudé
@ 2024-04-02 14:24 ` Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 13/15] gpio/pca955x: Update maintainer email address Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-02 14:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, qemu-block, qemu-arm, Marc-André Lureau,
	Klaus Jensen, Philippe Mathieu-Daudé, Keith Busch,
	Klaus Jensen, Jesper Devantier

From: Marc-André Lureau <marcandre.lureau@redhat.com>

../hw/nvme/ctrl.c:6081:21: error: ‘result’ may be used uninitialized [-Werror=maybe-uninitialized]

It's not obvious that 'result' is set in all code paths. When &result is
a returned argument, it's even less clear.

Looking at various assignments, 0 seems to be a suitable default value.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Message-ID: <20240328102052.3499331-18-marcandre.lureau@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/nvme/ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index c2b17de987..127c3d2383 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -5894,7 +5894,7 @@ static uint16_t nvme_get_feature(NvmeCtrl *n, NvmeRequest *req)
     uint32_t dw10 = le32_to_cpu(cmd->cdw10);
     uint32_t dw11 = le32_to_cpu(cmd->cdw11);
     uint32_t nsid = le32_to_cpu(cmd->nsid);
-    uint32_t result;
+    uint32_t result = 0;
     uint8_t fid = NVME_GETSETFEAT_FID(dw10);
     NvmeGetFeatureSelect sel = NVME_GETFEAT_SELECT(dw10);
     uint16_t iv;
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PULL 13/15] gpio/pca955x: Update maintainer email address
  2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
                   ` (11 preceding siblings ...)
  2024-04-02 14:24 ` [PULL 12/15] hw/nvme: fix -Werror=maybe-uninitialized Philippe Mathieu-Daudé
@ 2024-04-02 14:24 ` Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 14/15] hw/xen_evtchn: Initialize flush_kvm_routes Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-02 14:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, qemu-block, qemu-arm, Glenn Miles, Glenn Miles,
	Philippe Mathieu-Daudé

From: Glenn Miles <milesg@linux.vnet.ibm.com>

It was noticed that my linux.vnet.ibm.com address does not
always work so dropping the vnet to see if that works better.

Signed-off-by: Glenn Miles <milesg@linux.ibm.com>
Message-ID: <20240328194914.2145709-1-milesg@linux.vnet.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 197a06b42f..e71183eef9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1545,7 +1545,7 @@ F: pc-bios/skiboot.lid
 F: tests/qtest/pnv*
 
 pca955x
-M: Glenn Miles <milesg@linux.vnet.ibm.com>
+M: Glenn Miles <milesg@linux.ibm.com>
 L: qemu-ppc@nongnu.org
 L: qemu-arm@nongnu.org
 S: Odd Fixes
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PULL 14/15] hw/xen_evtchn: Initialize flush_kvm_routes
  2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
                   ` (12 preceding siblings ...)
  2024-04-02 14:24 ` [PULL 13/15] gpio/pca955x: Update maintainer email address Philippe Mathieu-Daudé
@ 2024-04-02 14:24 ` Philippe Mathieu-Daudé
  2024-04-02 14:24 ` [PULL 15/15] hw/net/virtio-net: fix qemu set used ring flag even vhost started Philippe Mathieu-Daudé
  2024-04-02 16:51 ` [PULL 00/15] Misc HW patches for 2024-04-02 Peter Maydell
  15 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-02 14:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, qemu-block, qemu-arm, Artem Chernyshev, Oleg Sviridov,
	Philippe Mathieu-Daudé, David Woodhouse, Paul Durrant,
	Paolo Bonzini, Richard Henderson, Eduardo Habkost,
	Michael S. Tsirkin, Marcel Apfelbaum

From: Artem Chernyshev <artem.chernyshev@red-soft.ru>

In xen_evtchn_soft_reset() variable flush_kvm_routes can
be used before being initialized.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Oleg Sviridov <oleg.sviridov@red-soft.ru>
Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240329113939.257033-1-artem.chernyshev@red-soft.ru>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/i386/kvm/xen_evtchn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c
index a5052c0ea3..07bd0c9ab8 100644
--- a/hw/i386/kvm/xen_evtchn.c
+++ b/hw/i386/kvm/xen_evtchn.c
@@ -1097,7 +1097,7 @@ static int close_port(XenEvtchnState *s, evtchn_port_t port,
 int xen_evtchn_soft_reset(void)
 {
     XenEvtchnState *s = xen_evtchn_singleton;
-    bool flush_kvm_routes;
+    bool flush_kvm_routes = false;
     int i;
 
     if (!s) {
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PULL 15/15] hw/net/virtio-net: fix qemu set used ring flag even vhost started
  2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
                   ` (13 preceding siblings ...)
  2024-04-02 14:24 ` [PULL 14/15] hw/xen_evtchn: Initialize flush_kvm_routes Philippe Mathieu-Daudé
@ 2024-04-02 14:24 ` Philippe Mathieu-Daudé
  2024-04-02 16:51 ` [PULL 00/15] Misc HW patches for 2024-04-02 Peter Maydell
  15 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-02 14:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, qemu-block, qemu-arm, Yajun Wu, Jiri Pirko,
	Michael S . Tsirkin, Philippe Mathieu-Daudé, Jason Wang

From: Yajun Wu <yajunw@nvidia.com>

When vhost-user or vhost-kernel is handling virtio net datapath,
QEMU should not touch used ring.

But with vhost-user socket reconnect scenario, in a very rare case
(has pending kick event). VRING_USED_F_NO_NOTIFY is set by QEMU in
following code path:

	#0  virtio_queue_split_set_notification (vq=0x7ff5f4c920a8, enable=0) at ../hw/virtio/virtio.c:511
	#1  0x0000559d6dbf033b in virtio_queue_set_notification (vq=0x7ff5f4c920a8, enable=0) at ../hw/virtio/virtio.c:576
	#2  0x0000559d6dbbbdbc in virtio_net_handle_tx_bh (vdev=0x559d703a6aa0, vq=0x7ff5f4c920a8) at ../hw/net/virtio-net.c:2801
	#3  0x0000559d6dbf4791 in virtio_queue_notify_vq (vq=0x7ff5f4c920a8) at ../hw/virtio/virtio.c:2248
	#4  0x0000559d6dbf79da in virtio_queue_host_notifier_read (n=0x7ff5f4c9211c) at ../hw/virtio/virtio.c:3525
	#5  0x0000559d6d9a5814 in virtio_bus_cleanup_host_notifier (bus=0x559d703a6a20, n=1) at ../hw/virtio/virtio-bus.c:321
	#6  0x0000559d6dbf83c9 in virtio_device_stop_ioeventfd_impl (vdev=0x559d703a6aa0) at ../hw/virtio/virtio.c:3774
	#7  0x0000559d6d9a55c8 in virtio_bus_stop_ioeventfd (bus=0x559d703a6a20) at ../hw/virtio/virtio-bus.c:259
	#8  0x0000559d6d9a53e8 in virtio_bus_grab_ioeventfd (bus=0x559d703a6a20) at ../hw/virtio/virtio-bus.c:199
	#9  0x0000559d6dbf841c in virtio_device_grab_ioeventfd (vdev=0x559d703a6aa0) at ../hw/virtio/virtio.c:3783
	#10 0x0000559d6d9bde18 in vhost_dev_enable_notifiers (hdev=0x559d707edd70, vdev=0x559d703a6aa0) at ../hw/virtio/vhost.c:1592
	#11 0x0000559d6d89a0b8 in vhost_net_start_one (net=0x559d707edd70, dev=0x559d703a6aa0) at ../hw/net/vhost_net.c:266
	#12 0x0000559d6d89a6df in vhost_net_start (dev=0x559d703a6aa0, ncs=0x559d7048d890, data_queue_pairs=31, cvq=0) at ../hw/net/vhost_net.c:412
	#13 0x0000559d6dbb5b89 in virtio_net_vhost_status (n=0x559d703a6aa0, status=15 '\017') at ../hw/net/virtio-net.c:311
	#14 0x0000559d6dbb5e34 in virtio_net_set_status (vdev=0x559d703a6aa0, status=15 '\017') at ../hw/net/virtio-net.c:392
	#15 0x0000559d6dbb60d8 in virtio_net_set_link_status (nc=0x559d7048d890) at ../hw/net/virtio-net.c:455
	#16 0x0000559d6da64863 in qmp_set_link (name=0x559d6f0b83d0 "hostnet1", up=true, errp=0x7ffdd76569f0) at ../net/net.c:1459
	#17 0x0000559d6da7226e in net_vhost_user_event (opaque=0x559d6f0b83d0, event=CHR_EVENT_OPENED) at ../net/vhost-user.c:301
	#18 0x0000559d6ddc7f63 in chr_be_event (s=0x559d6f2ffea0, event=CHR_EVENT_OPENED) at ../chardev/char.c:62
	#19 0x0000559d6ddc7fdc in qemu_chr_be_event (s=0x559d6f2ffea0, event=CHR_EVENT_OPENED) at ../chardev/char.c:82

This issue causes guest kernel stop kicking device and traffic stop.

Add vhost_started check in virtio_net_handle_tx_bh to fix this wrong
VRING_USED_F_NO_NOTIFY set.

Signed-off-by: Yajun Wu <yajunw@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20240402045109.97729-1-yajunw@nvidia.com>
[PMD: Use unlikely()]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/net/virtio-net.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index a6ff000cd9..58014a92ad 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -2865,6 +2865,10 @@ static void virtio_net_handle_tx_bh(VirtIODevice *vdev, VirtQueue *vq)
     VirtIONet *n = VIRTIO_NET(vdev);
     VirtIONetQueue *q = &n->vqs[vq2q(virtio_get_queue_index(vq))];
 
+    if (unlikely(n->vhost_started)) {
+        return;
+    }
+
     if (unlikely((n->status & VIRTIO_NET_S_LINK_UP) == 0)) {
         virtio_net_drop_tx_queue_data(vdev, vq);
         return;
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PULL 00/15] Misc HW patches for 2024-04-02
  2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
                   ` (14 preceding siblings ...)
  2024-04-02 14:24 ` [PULL 15/15] hw/net/virtio-net: fix qemu set used ring flag even vhost started Philippe Mathieu-Daudé
@ 2024-04-02 16:51 ` Peter Maydell
  15 siblings, 0 replies; 17+ messages in thread
From: Peter Maydell @ 2024-04-02 16:51 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: qemu-devel, qemu-ppc, qemu-block, qemu-arm

On Tue, 2 Apr 2024 at 15:25, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> The following changes since commit 7fcf7575f3d201fc84ae168017ffdfd6c86257a6:
>
>   Merge tag 'pull-target-arm-20240402' of https://git.linaro.org/people/pmaydell/qemu-arm into staging (2024-04-02 11:34:49 +0100)
>
> are available in the Git repository at:
>
>   https://github.com/philmd/qemu.git tags/hw-misc-20240402
>
> for you to fetch changes up to 4c54f5bc8e1d38f15cc35b6a6932d8fbe219c692:
>
>   hw/net/virtio-net: fix qemu set used ring flag even vhost started (2024-04-02 16:15:07 +0200)
>
> ----------------------------------------------------------------
> Misc HW patch queue
>
> - MAINTAINERS updates (Zhao, Glenn)
> - Replace incorrect mentions of 'softmmu' by 'system' (Phil)
> - Avoid using inlined functions with external linkage (Phil)
> - Restrict CXL to x86 PC PCI-based machines (Phil)
> - Remove unnecessary NULL check in bdrv_pad_request (Kevin)
> - Fix a pair of -Werror=maybe-uninitialized (Marc-André)
> - Initialize variable in xen_evtchn_soft_reset (Artem)
> - Do not access virtio-net tx queue until vhost is started (Yajun)


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/9.0
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-04-02 16:53 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-02 14:24 [PULL 00/15] Misc HW patches for 2024-04-02 Philippe Mathieu-Daudé
2024-04-02 14:24 ` [PULL 01/15] accel/tcg/plugin: Remove CONFIG_SOFTMMU_GATE definition Philippe Mathieu-Daudé
2024-04-02 14:24 ` [PULL 02/15] gdbstub: Correct invalid mentions of 'softmmu' by 'system' Philippe Mathieu-Daudé
2024-04-02 14:24 ` [PULL 03/15] gdbstub/system: Rename 'user_ctx' argument as 'ctx' Philippe Mathieu-Daudé
2024-04-02 14:24 ` [PULL 04/15] target/ppc: Rename init_excp_4xx_softmmu() -> init_excp_4xx() Philippe Mathieu-Daudé
2024-04-02 14:24 ` [PULL 05/15] hw/arm/smmu: Avoid using inlined functions with external linkage again Philippe Mathieu-Daudé
2024-04-02 14:24 ` [PULL 06/15] accel/hvf: Un-inline hvf_arch_supports_guest_debug() Philippe Mathieu-Daudé
2024-04-02 14:24 ` [PULL 07/15] qtest/libqos: Reduce size_to_prdtl() declaration scope Philippe Mathieu-Daudé
2024-04-02 14:24 ` [PULL 08/15] MAINTAINERS: Fix error-report.c entry Philippe Mathieu-Daudé
2024-04-02 14:24 ` [PULL 09/15] hw/i386/pc: Restrict CXL to PCI-based machines Philippe Mathieu-Daudé
2024-04-02 14:24 ` [PULL 10/15] block: Remove unnecessary NULL check in bdrv_pad_request() Philippe Mathieu-Daudé
2024-04-02 14:24 ` [PULL 11/15] plugins: fix -Werror=maybe-uninitialized false-positive Philippe Mathieu-Daudé
2024-04-02 14:24 ` [PULL 12/15] hw/nvme: fix -Werror=maybe-uninitialized Philippe Mathieu-Daudé
2024-04-02 14:24 ` [PULL 13/15] gpio/pca955x: Update maintainer email address Philippe Mathieu-Daudé
2024-04-02 14:24 ` [PULL 14/15] hw/xen_evtchn: Initialize flush_kvm_routes Philippe Mathieu-Daudé
2024-04-02 14:24 ` [PULL 15/15] hw/net/virtio-net: fix qemu set used ring flag even vhost started Philippe Mathieu-Daudé
2024-04-02 16:51 ` [PULL 00/15] Misc HW patches for 2024-04-02 Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).