diff mbox series

[1/3] tests/acceptance: test virtio-ccw revision handling

Message ID 20201130180216.15366-2-cohuck@redhat.com (mailing list archive)
State New, archived
Headers show
Series tests/acceptance: enhance s390x devices test | expand

Commit Message

Cornelia Huck Nov. 30, 2020, 6:02 p.m. UTC
The max_revision prop of virtio-ccw devices can be used to force
an older revision for compatibility handling. The easiest way to
check this is to force a device to revision 0, which turns off
virtio-1.

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
 tests/acceptance/machine_s390_ccw_virtio.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

Comments

Thomas Huth Dec. 1, 2020, 10:43 a.m. UTC | #1
On 30/11/2020 19.02, Cornelia Huck wrote:
> The max_revision prop of virtio-ccw devices can be used to force
> an older revision for compatibility handling. The easiest way to
> check this is to force a device to revision 0, which turns off
> virtio-1.
> 
> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
> ---
>  tests/acceptance/machine_s390_ccw_virtio.py | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>
Wainer dos Santos Moschetta Dec. 4, 2020, 1:36 p.m. UTC | #2
Hi,

On 11/30/20 3:02 PM, Cornelia Huck wrote:
> The max_revision prop of virtio-ccw devices can be used to force
> an older revision for compatibility handling. The easiest way to
> check this is to force a device to revision 0, which turns off
> virtio-1.
>
> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
> ---
>   tests/acceptance/machine_s390_ccw_virtio.py | 18 ++++++++++++++++--
>   1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/tests/acceptance/machine_s390_ccw_virtio.py b/tests/acceptance/machine_s390_ccw_virtio.py
> index db6352c44434..683b6e0dac2e 100644
> --- a/tests/acceptance/machine_s390_ccw_virtio.py
> +++ b/tests/acceptance/machine_s390_ccw_virtio.py
> @@ -51,6 +51,10 @@ class S390CCWVirtioMachine(Test):
>                            '-initrd', initrd_path,
>                            '-append', kernel_command_line,
>                            '-device', 'virtio-net-ccw,devno=fe.1.1111',
> +                         '-device',
> +                         'virtio-rng-ccw,devno=fe.2.0000,max_revision=0',
> +                         '-device',
> +                         'virtio-rng-ccw,devno=fe.3.1234,max_revision=2',
>                            '-device', 'zpci,uid=5,target=zzz',
>                            '-device', 'virtio-net-pci,id=zzz')
>           self.vm.launch()
> @@ -60,9 +64,19 @@ class S390CCWVirtioMachine(Test):
>           # first debug shell is too early, we need to wait for device detection
>           exec_command_and_wait_for_pattern(self, 'exit', shell_ready)
>   
> -        ccw_bus_id="0.1.1111"
> +        ccw_bus_ids="0.1.1111  0.2.0000  0.3.1234"
>           pci_bus_id="0005:00:00.0"
>           exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/',
> -                                          ccw_bus_id)
> +                                          ccw_bus_ids)
>           exec_command_and_wait_for_pattern(self, 'ls /sys/bus/pci/devices/',
>                                             pci_bus_id)
> +        # check that the device at 0.2.0000 is in legacy mode, while the
> +        # device at 0.3.1234 has the virtio-1 feature bit set
> +        virtio_rng_features="0000000000000000000000000000110010000000000000000000000000000000"
> +        virtio_rng_features_legacy="0000000000000000000000000000110000000000000000000000000000000000"

Do something like...

virtio_rng_features="0000000000000000000000000000" + \
     "110010000000000000000000000000000000"

... and checkpatch should not complain.


Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>


> +        exec_command_and_wait_for_pattern(self,
> +                                          'cat /sys/bus/ccw/devices/0.2.0000/virtio?/features',
> +                                          virtio_rng_features_legacy)
> +        exec_command_and_wait_for_pattern(self,
> +                                          'cat /sys/bus/ccw/devices/0.3.1234/virtio?/features',
> +                                          virtio_rng_features)
Cornelia Huck Dec. 7, 2020, 11:09 a.m. UTC | #3
On Fri, 4 Dec 2020 10:36:33 -0300
Wainer dos Santos Moschetta <wainersm@redhat.com> wrote:

> Hi,
> 
> On 11/30/20 3:02 PM, Cornelia Huck wrote:
> > The max_revision prop of virtio-ccw devices can be used to force
> > an older revision for compatibility handling. The easiest way to
> > check this is to force a device to revision 0, which turns off
> > virtio-1.
> >
> > Signed-off-by: Cornelia Huck <cohuck@redhat.com>
> > ---
> >   tests/acceptance/machine_s390_ccw_virtio.py | 18 ++++++++++++++++--
> >   1 file changed, 16 insertions(+), 2 deletions(-)
> >
> > diff --git a/tests/acceptance/machine_s390_ccw_virtio.py b/tests/acceptance/machine_s390_ccw_virtio.py
> > index db6352c44434..683b6e0dac2e 100644
> > --- a/tests/acceptance/machine_s390_ccw_virtio.py
> > +++ b/tests/acceptance/machine_s390_ccw_virtio.py
> > @@ -51,6 +51,10 @@ class S390CCWVirtioMachine(Test):
> >                            '-initrd', initrd_path,
> >                            '-append', kernel_command_line,
> >                            '-device', 'virtio-net-ccw,devno=fe.1.1111',
> > +                         '-device',
> > +                         'virtio-rng-ccw,devno=fe.2.0000,max_revision=0',
> > +                         '-device',
> > +                         'virtio-rng-ccw,devno=fe.3.1234,max_revision=2',
> >                            '-device', 'zpci,uid=5,target=zzz',
> >                            '-device', 'virtio-net-pci,id=zzz')
> >           self.vm.launch()
> > @@ -60,9 +64,19 @@ class S390CCWVirtioMachine(Test):
> >           # first debug shell is too early, we need to wait for device detection
> >           exec_command_and_wait_for_pattern(self, 'exit', shell_ready)
> >   
> > -        ccw_bus_id="0.1.1111"
> > +        ccw_bus_ids="0.1.1111  0.2.0000  0.3.1234"
> >           pci_bus_id="0005:00:00.0"
> >           exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/',
> > -                                          ccw_bus_id)
> > +                                          ccw_bus_ids)
> >           exec_command_and_wait_for_pattern(self, 'ls /sys/bus/pci/devices/',
> >                                             pci_bus_id)
> > +        # check that the device at 0.2.0000 is in legacy mode, while the
> > +        # device at 0.3.1234 has the virtio-1 feature bit set
> > +        virtio_rng_features="0000000000000000000000000000110010000000000000000000000000000000"
> > +        virtio_rng_features_legacy="0000000000000000000000000000110000000000000000000000000000000000"  
> 
> Do something like...
> 
> virtio_rng_features="0000000000000000000000000000" + \
>      "110010000000000000000000000000000000"
> 
> ... and checkpatch should not complain.

Yes, I can tweak it like that before queuing.

> 
> 
> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>

Thanks!

> 
> 
> > +        exec_command_and_wait_for_pattern(self,
> > +                                          'cat /sys/bus/ccw/devices/0.2.0000/virtio?/features',
> > +                                          virtio_rng_features_legacy)
> > +        exec_command_and_wait_for_pattern(self,
> > +                                          'cat /sys/bus/ccw/devices/0.3.1234/virtio?/features',
> > +                                          virtio_rng_features)
diff mbox series

Patch

diff --git a/tests/acceptance/machine_s390_ccw_virtio.py b/tests/acceptance/machine_s390_ccw_virtio.py
index db6352c44434..683b6e0dac2e 100644
--- a/tests/acceptance/machine_s390_ccw_virtio.py
+++ b/tests/acceptance/machine_s390_ccw_virtio.py
@@ -51,6 +51,10 @@  class S390CCWVirtioMachine(Test):
                          '-initrd', initrd_path,
                          '-append', kernel_command_line,
                          '-device', 'virtio-net-ccw,devno=fe.1.1111',
+                         '-device',
+                         'virtio-rng-ccw,devno=fe.2.0000,max_revision=0',
+                         '-device',
+                         'virtio-rng-ccw,devno=fe.3.1234,max_revision=2',
                          '-device', 'zpci,uid=5,target=zzz',
                          '-device', 'virtio-net-pci,id=zzz')
         self.vm.launch()
@@ -60,9 +64,19 @@  class S390CCWVirtioMachine(Test):
         # first debug shell is too early, we need to wait for device detection
         exec_command_and_wait_for_pattern(self, 'exit', shell_ready)
 
-        ccw_bus_id="0.1.1111"
+        ccw_bus_ids="0.1.1111  0.2.0000  0.3.1234"
         pci_bus_id="0005:00:00.0"
         exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/',
-                                          ccw_bus_id)
+                                          ccw_bus_ids)
         exec_command_and_wait_for_pattern(self, 'ls /sys/bus/pci/devices/',
                                           pci_bus_id)
+        # check that the device at 0.2.0000 is in legacy mode, while the
+        # device at 0.3.1234 has the virtio-1 feature bit set
+        virtio_rng_features="0000000000000000000000000000110010000000000000000000000000000000"
+        virtio_rng_features_legacy="0000000000000000000000000000110000000000000000000000000000000000"
+        exec_command_and_wait_for_pattern(self,
+                                          'cat /sys/bus/ccw/devices/0.2.0000/virtio?/features',
+                                          virtio_rng_features_legacy)
+        exec_command_and_wait_for_pattern(self,
+                                          'cat /sys/bus/ccw/devices/0.3.1234/virtio?/features',
+                                          virtio_rng_features)