From 471676bfd2e182746b9bb0ff4e613908dc4c8842 Mon Sep 17 00:00:00 2001 From: Pierre Morel Date: Mon, 16 Oct 2023 20:39:22 +0200 Subject: [PATCH] tests/avocado: s390x cpu topology test dedicated CPU A dedicated CPU in vertical polarization can only have a high entitlement. Let's check this from both host and guest point of view. Signed-off-by: Pierre Morel Co-developed-by: Nina Schoetterl-Glausch Reviewed-by: Thomas Huth Reviewed-by: Nina Schoetterl-Glausch Signed-off-by: Nina Schoetterl-Glausch Message-ID: <20231016183925.2384704-19-nsg@linux.ibm.com> Signed-off-by: Thomas Huth --- tests/avocado/s390_topology.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/avocado/s390_topology.py b/tests/avocado/s390_topology.py index 24fac9a54d..3661048f4c 100644 --- a/tests/avocado/s390_topology.py +++ b/tests/avocado/s390_topology.py @@ -305,3 +305,36 @@ class S390CPUTopology(QemuSystemTest): self.guest_set_dispatching('0'); self.check_polarization("horizontal") self.check_topology(0, 0, 0, 0, 'high', False) + + + def test_dedicated(self): + """ + This test verifies that QEMU adjusts the entitlement correctly when a + CPU is made dedicated. + QEMU retains the entitlement value when horizontal polarization is in effect. + For the guest, the field shows the effective value of the entitlement. + + :avocado: tags=arch:s390x + :avocado: tags=machine:s390-ccw-virtio + """ + self.kernel_init() + self.vm.launch() + self.wait_until_booted() + + self.system_init() + + self.check_polarization("horizontal") + + res = self.vm.qmp('set-cpu-topology', + {'core-id': 0, 'dedicated': True}) + self.assertEqual(res['return'], {}) + self.check_topology(0, 0, 0, 0, 'high', True) + self.check_polarization("horizontal") + + self.guest_set_dispatching('1'); + self.check_topology(0, 0, 0, 0, 'high', True) + self.check_polarization("vertical:high") + + self.guest_set_dispatching('0'); + self.check_topology(0, 0, 0, 0, 'high', True) + self.check_polarization("horizontal")