On 5/11/2026 11:01 AM, Pierrick Bouvier wrote:
> On 5/11/2026 10:47 AM, Philippe Mathieu-Daudé wrote:
>> On 11/5/26 18:36, Cédric Le Goater wrote:
>>> On 5/11/26 17:58, Eric Farman wrote:
>>>> On Mon, 2026-05-11 at 17:48 +0200, Cédric Le Goater wrote:
>>>>> Hello,
>>>>>
>>>>> On 5/6/26 15:55, Philippe Mathieu-Daudé wrote:
>>>>>> Introduce a source set common to system / user. Start it
>>>>>> with the files built in both sets: 'cpu_models_user.c'
>>>>>> and 'gdbstub.c' No logical change intended.
>>>>>>
>>>>>> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
>>>>>> Reviewed-by: Ilya Leoshkevich <[email protected]>
>>>>>> Message-Id: <[email protected]>
>>>>>
>>>>> This change introduced a regression with PCI passthrough which
>>>>> stopped working. Guest kernel reports :
>>>>>
>>>>>     [    0.156501] zpci: PCI is not supported because CPU facilities
>>>>> 69 or 71 are not available
>>>>>
>>>>> and other devices (ap, ccw) are impacted too I think.
>>>>>
>>>>>> ---
>>>>>>    target/s390x/meson.build | 25 +++++++++++++------------
>>>>>>    1 file changed, 13 insertions(+), 12 deletions(-)
>>>>>>
>>>>>> diff --git a/target/s390x/meson.build b/target/s390x/meson.build
>>>>>> index 6f98ce34d73..44f58ac2919 100644
>>>>>> --- a/target/s390x/meson.build
>>>>>> +++ b/target/s390x/meson.build
>>>>>> @@ -1,4 +1,9 @@
>>>>>>    s390x_ss = ss.source_set()
>>>>>> +s390x_common_ss = ss.source_set()
>>>>>> +s390x_common_system_ss = ss.source_set()
>>>>>> +s390x_system_ss = ss.source_set()
>>>>>> +s390x_user_ss = ss.source_set()
>>>>>> +
>>>>>>    s390x_ss.add(files(
>>>>>>      'cpu.c',
>>>>>>      'cpu_features.c',
>>>>>> @@ -15,15 +20,16 @@ gen_features_h = custom_target('gen-features.h',
>>>>>>                                   capture: true,
>>>>>>                                   command: gen_features)
>>>>>> -s390x_ss.add(gen_features_h)
>>>>>> +s390x_common_ss.add(gen_features_h)
>>>>>> +s390x_common_ss.add(files(
>>>>>> +  'cpu_models_user.c',
>>>>>> +  'gdbstub.c',
>>>>>> +))
>>>>>> -s390x_system_ss = ss.source_set()
>>>>>>    s390x_system_ss.add(files(
>>>>>>      'ioinst.c',
>>>>>>    ))
>>>>>> -s390x_common_system_ss = ss.source_set()
>>>>>> -s390x_common_system_ss.add(gen_features_h)
>>>>>>    s390x_common_system_ss.add(files(
>>>>>>      'helper.c',
>>>>>>      'arch_dump.c',
>>>>>> @@ -32,19 +38,14 @@ s390x_common_system_ss.add(files(
>>>>>>      'mmu_helper.c',
>>>>>>      'sigp.c',
>>>>>>      'cpu-system.c',
>>>>>> -  'cpu_models_system.c',
>>>>>
>>>>> This file is compiled anymore and the CPU features and facilities are
>>>>> not propagated to the guest anymore.
>>>>>
>>>>> Without this patch, cpuinfo reports :
>>>>>
>>>>>     features    : esan3 zarch stfle msa ldisp eimm dfp edat etf3eh
>>>>> highgprs te vx vxd vxe gs vxe2 vxp sort dflt vxp2 nnpa
>>>>>     facilities      : 0 1 2 3 4 6 7 8 9 10 11 12 13 14 15 16 17 18
>>>>> 19 20 21 22 23 24 25 26 27 28 30 31 32 33 34 35 36 37 38 40 41 42 43
>>>>> 44 45 47 48 49 50 51 52 53 54 57 58 59 60 61 64 65 69 71 72 73 74 75
>>>>> 76 77 78 80 81 82 129 130 131 133 134 135 138 139 140 146 147 148
>>>>> 150 151 152 155 156 165 192 193 194 196 197
>>>>>
>>>>> with :
>>>>>
>>>>>     features    : esan3 zarch stfle msa ldisp eimm dfp edat etf3eh
>>>>> highgprs te vx vxd vxe gs vxe2 vxp sort dflt vxp2
>>>>>     acilities      : 0 1 2 3 4 6 7 8 9 10 11 13 14 16 17 18 19 20 21
>>>>> 22 23 24 25 26 27 28 30 31 32 33 34 35 36 37 38 40 41 42 43 44 45 46
>>>>> 47 48 49 50 51 52 53 54 55 57 58 59 60 61 64 72 73 74 75 76 77 78 80
>>>>> 81 82 129 130 131 133 134 135 138 139 146 147 148 150 151 152 155 192
>>>>>
>>>>
>>>> Thanks, Cedric... I wonder if the above is addressed by this patch?
>>>> (I haven't checked yet, but will
>>>> do that now.)
>>>>
>>>> https://lore.kernel.org/qemu-devel/20260510204640.2178926-1-
>>>> [email protected]/
>>>
>>> Something like below seems to work.
>>>
>>> C.
>>>
>>>
>>> @@ -22,7 +22,6 @@ gen_features_h = custom_target('gen-feat
>>>
>>>   s390x_common_ss.add(gen_features_h)
>>>   s390x_common_ss.add(files(
>>> -  'cpu_models_user.c',
>>>     'gdbstub.c',
>>>   ))
>>>
>>> @@ -38,8 +37,11 @@ s390x_common_system_ss.add(files(
>>>     'mmu_helper.c',
>>>     'sigp.c',
>>>     'cpu-system.c',
>>> +  'cpu_models_system.c',
>>>   ))
>>>
>>> +s390x_user_ss.add(files('cpu_models_user.c'))
>>> +
>>>   subdir('tcg')
>>>   subdir('kvm')
>>
>> Right. I wonder how I could screw that change...
>>
>>
> 
> The only possible thing is that code becoming common skipped some ifdef
> that were here before per target.
> So, something that should have been poisoned has not been, and we
> definitely need to identify what it is to prevent other regressions like
> this.
> 
> Regards,
> Pierrick

Fortunately, it was a much simpler bug, where we incorrectly removed
cpu_models_system.c completely, and used user stubs for all versions.

Attached patch should fix it. Can you please test and confirm?

Regards,
Pierrick
From 7921b534de0d10634e3dff15f9f5f2163d82c729 Mon Sep 17 00:00:00 2001
From: Pierrick Bouvier <[email protected]>
Date: Mon, 11 May 2026 11:08:38 -0700
Subject: [PATCH] target/s390x: fix cpu_models build between user/system

A recent commit incorrectly replaced cpu_models_system by stubs
cpu_models_user, thus breaking PCI passthrough on s390.
Fix it by correctly using system/user version as it was done before.

Fixes: 0b83acf2f056cc7f5a9b05b1af9c97c91e2a7b1e ("target/s390x: Introduce 
common system/user meson source set")
Signed-off-by: Pierrick Bouvier <[email protected]>
---
 target/s390x/meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/s390x/meson.build b/target/s390x/meson.build
index 44f58ac2919..316cdb954f8 100644
--- a/target/s390x/meson.build
+++ b/target/s390x/meson.build
@@ -22,7 +22,6 @@ gen_features_h = custom_target('gen-features.h',
 
 s390x_common_ss.add(gen_features_h)
 s390x_common_ss.add(files(
-  'cpu_models_user.c',
   'gdbstub.c',
 ))
 
@@ -30,6 +29,8 @@ s390x_system_ss.add(files(
   'ioinst.c',
 ))
 
+s390x_user_ss.add(files('cpu_models_user.c'))
+
 s390x_common_system_ss.add(files(
   'helper.c',
   'arch_dump.c',
@@ -38,6 +39,7 @@ s390x_common_system_ss.add(files(
   'mmu_helper.c',
   'sigp.c',
   'cpu-system.c',
+  'cpu_models_system.c',
 ))
 
 subdir('tcg')
-- 
2.43.0

Reply via email to