All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/scsi/vhost-scsi: fix build with older kernel headers
@ 2026-05-25 18:27 Quan.Sun
  2026-05-25 22:39 ` Michael S. Tsirkin
  2026-05-27 16:16 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 5+ messages in thread
From: Quan.Sun @ 2026-05-25 18:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, fam, mst, sgarzare, Quan.Sun

From: Quan Sun <Quan.Sun@windriver.com>

On build hosts with kernel headers older than 6.0, the system's
<linux/vhost_types.h> does not define struct vhost_vring_worker or
struct vhost_worker_state, causing compilation of vhost-scsi.c to
fail:

  error: storage size of 'vq_worker' isn't known

Fix by including standard-headers/linux/vhost_types.h before the
system's <linux/vhost.h>, matching the existing pattern used in
hw/virtio/vhost-backend.c. QEMU's bundled header provides the
struct definitions, and its include guard prevents redefinition
when the system header pulls in its own vhost_types.h.

Signed-off-by: Quan Sun <Quan.Sun@windriver.com>
---
 hw/scsi/vhost-scsi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
index 699863cc10..10e8fbe503 100644
--- a/hw/scsi/vhost-scsi.c
+++ b/hw/scsi/vhost-scsi.c
@@ -15,6 +15,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "standard-headers/linux/vhost_types.h"
 #include <linux/vhost.h>
 #include <sys/ioctl.h>
 #include "qapi/error.h"
-- 
2.43.0



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

* Re: [PATCH] hw/scsi/vhost-scsi: fix build with older kernel headers
  2026-05-25 18:27 [PATCH] hw/scsi/vhost-scsi: fix build with older kernel headers Quan.Sun
@ 2026-05-25 22:39 ` Michael S. Tsirkin
  2026-05-26 14:27   ` Quan Sun
  2026-05-27 16:16 ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 5+ messages in thread
From: Michael S. Tsirkin @ 2026-05-25 22:39 UTC (permalink / raw)
  To: Quan.Sun; +Cc: qemu-devel, pbonzini, fam, sgarzare

On Mon, May 25, 2026 at 11:27:30AM -0700, Quan.Sun@windriver.com wrote:
> From: Quan Sun <Quan.Sun@windriver.com>
> 
> On build hosts with kernel headers older than 6.0, the system's
> <linux/vhost_types.h> does not define struct vhost_vring_worker or
> struct vhost_worker_state, causing compilation of vhost-scsi.c to
> fail:
> 
>   error: storage size of 'vq_worker' isn't known
> 
> Fix by including standard-headers/linux/vhost_types.h before the
> system's <linux/vhost.h>, matching the existing pattern used in
> hw/virtio/vhost-backend.c. QEMU's bundled header provides the
> struct definitions, and its include guard prevents redefinition
> when the system header pulls in its own vhost_types.h.
> 
> Signed-off-by: Quan Sun <Quan.Sun@windriver.com>


Hmm. maybe replace linux/vhost.h with standard-headers/linux/vhost.h then?


> ---
>  hw/scsi/vhost-scsi.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
> index 699863cc10..10e8fbe503 100644
> --- a/hw/scsi/vhost-scsi.c
> +++ b/hw/scsi/vhost-scsi.c
> @@ -15,6 +15,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#include "standard-headers/linux/vhost_types.h"
>  #include <linux/vhost.h>
>  #include <sys/ioctl.h>
>  #include "qapi/error.h"
> -- 
> 2.43.0



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

* Re: [PATCH] hw/scsi/vhost-scsi: fix build with older kernel headers
  2026-05-25 22:39 ` Michael S. Tsirkin
@ 2026-05-26 14:27   ` Quan Sun
  2026-05-26 18:05     ` Michael S. Tsirkin
  0 siblings, 1 reply; 5+ messages in thread
From: Quan Sun @ 2026-05-26 14:27 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel, pbonzini, fam, sgarzare


On 5/25/26 6:39 PM, Michael S. Tsirkin wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Mon, May 25, 2026 at 11:27:30AM -0700,Quan.Sun@windriver.com wrote:
>> From: Quan Sun<Quan.Sun@windriver.com>
>>
>> On build hosts with kernel headers older than 6.0, the system's
>> <linux/vhost_types.h> does not define struct vhost_vring_worker or
>> struct vhost_worker_state, causing compilation of vhost-scsi.c to
>> fail:
>>
>>    error: storage size of 'vq_worker' isn't known
>>
>> Fix by including standard-headers/linux/vhost_types.h before the
>> system's <linux/vhost.h>, matching the existing pattern used in
>> hw/virtio/vhost-backend.c. QEMU's bundled header provides the
>> struct definitions, and its include guard prevents redefinition
>> when the system header pulls in its own vhost_types.h.
>>
>> Signed-off-by: Quan Sun<Quan.Sun@windriver.com>
> Hmm. maybe replace linux/vhost.h with standard-headers/linux/vhost.h then?

Hi Michael,

It seems there is no standard-headers/linux/vhost.h in QEMU's tree — only
standard-headers/linux/vhost_types.h. The file linux/vhost.h (the kernel 
header) is
still needed here for the vhost-scsi specific definitions (struct 
vhost_scsi_target, VHOST_SCSI_ABI_VERSION). The approach in this patch
matches the existing pattern in hw/virtio/vhost-backend.c, which also 
includes
standard-headers/linux/vhost_types.h before linux/vhost.h to get the struct
definitions that may be missing from older host kernel headers.

Thanks,

Quan

>> ---
>>   hw/scsi/vhost-scsi.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
>> index 699863cc10..10e8fbe503 100644
>> --- a/hw/scsi/vhost-scsi.c
>> +++ b/hw/scsi/vhost-scsi.c
>> @@ -15,6 +15,7 @@
>>    */
>>
>>   #include "qemu/osdep.h"
>> +#include "standard-headers/linux/vhost_types.h"
>>   #include <linux/vhost.h>
>>   #include <sys/ioctl.h>
>>   #include "qapi/error.h"
>> --
>> 2.43.0


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

* Re: [PATCH] hw/scsi/vhost-scsi: fix build with older kernel headers
  2026-05-26 14:27   ` Quan Sun
@ 2026-05-26 18:05     ` Michael S. Tsirkin
  0 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2026-05-26 18:05 UTC (permalink / raw)
  To: Quan Sun; +Cc: qemu-devel, pbonzini, fam, sgarzare

On Tue, May 26, 2026 at 10:27:57AM -0400, Quan Sun wrote:
> 
> On 5/25/26 6:39 PM, Michael S. Tsirkin wrote:
> > CAUTION: This email comes from a non Wind River email account!
> > Do not click links or open attachments unless you recognize the sender and know the content is safe.
> > 
> > On Mon, May 25, 2026 at 11:27:30AM -0700,Quan.Sun@windriver.com wrote:
> > > From: Quan Sun<Quan.Sun@windriver.com>
> > > 
> > > On build hosts with kernel headers older than 6.0, the system's
> > > <linux/vhost_types.h> does not define struct vhost_vring_worker or
> > > struct vhost_worker_state, causing compilation of vhost-scsi.c to
> > > fail:
> > > 
> > >    error: storage size of 'vq_worker' isn't known
> > > 
> > > Fix by including standard-headers/linux/vhost_types.h before the
> > > system's <linux/vhost.h>, matching the existing pattern used in
> > > hw/virtio/vhost-backend.c. QEMU's bundled header provides the
> > > struct definitions, and its include guard prevents redefinition
> > > when the system header pulls in its own vhost_types.h.
> > > 
> > > Signed-off-by: Quan Sun<Quan.Sun@windriver.com>
> > Hmm. maybe replace linux/vhost.h with standard-headers/linux/vhost.h then?
> 
> Hi Michael,
> 
> It seems there is no standard-headers/linux/vhost.h in QEMU's tree — only
> standard-headers/linux/vhost_types.h. The file linux/vhost.h (the kernel
> header) is
> still needed here for the vhost-scsi specific definitions (struct
> vhost_scsi_target, VHOST_SCSI_ABI_VERSION). The approach in this patch
> matches the existing pattern in hw/virtio/vhost-backend.c, which also
> includes
> standard-headers/linux/vhost_types.h before linux/vhost.h to get the struct
> definitions that may be missing from older host kernel headers.
> 
> Thanks,
> 
> Quan

Alright.

> > > ---
> > >   hw/scsi/vhost-scsi.c | 1 +
> > >   1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
> > > index 699863cc10..10e8fbe503 100644
> > > --- a/hw/scsi/vhost-scsi.c
> > > +++ b/hw/scsi/vhost-scsi.c
> > > @@ -15,6 +15,7 @@
> > >    */
> > > 
> > >   #include "qemu/osdep.h"
> > > +#include "standard-headers/linux/vhost_types.h"
> > >   #include <linux/vhost.h>
> > >   #include <sys/ioctl.h>
> > >   #include "qapi/error.h"
> > > --
> > > 2.43.0



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

* Re: [PATCH] hw/scsi/vhost-scsi: fix build with older kernel headers
  2026-05-25 18:27 [PATCH] hw/scsi/vhost-scsi: fix build with older kernel headers Quan.Sun
  2026-05-25 22:39 ` Michael S. Tsirkin
@ 2026-05-27 16:16 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-05-27 16:16 UTC (permalink / raw)
  To: Quan.Sun, qemu-devel; +Cc: pbonzini, fam, mst, sgarzare

On 25/5/26 20:27, Quan.Sun@windriver.com wrote:
> From: Quan Sun <Quan.Sun@windriver.com>
> 
> On build hosts with kernel headers older than 6.0, the system's
> <linux/vhost_types.h> does not define struct vhost_vring_worker or
> struct vhost_worker_state, causing compilation of vhost-scsi.c to
> fail:
> 
>    error: storage size of 'vq_worker' isn't known
> 
> Fix by including standard-headers/linux/vhost_types.h before the
> system's <linux/vhost.h>, matching the existing pattern used in
> hw/virtio/vhost-backend.c. QEMU's bundled header provides the
> struct definitions, and its include guard prevents redefinition
> when the system header pulls in its own vhost_types.h.
> 
> Signed-off-by: Quan Sun <Quan.Sun@windriver.com>
> ---
>   hw/scsi/vhost-scsi.c | 1 +
>   1 file changed, 1 insertion(+)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


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

end of thread, other threads:[~2026-05-27 16:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-25 18:27 [PATCH] hw/scsi/vhost-scsi: fix build with older kernel headers Quan.Sun
2026-05-25 22:39 ` Michael S. Tsirkin
2026-05-26 14:27   ` Quan Sun
2026-05-26 18:05     ` Michael S. Tsirkin
2026-05-27 16:16 ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.