From nobody Mon May 6 22:59:49 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1678274469281558.7186704402471; Wed, 8 Mar 2023 03:21:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZrq9-0005by-49; Wed, 08 Mar 2023 06:20:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZrq6-0005bD-Dd for qemu-devel@nongnu.org; Wed, 08 Mar 2023 06:20:10 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZrq2-0005zA-Uh for qemu-devel@nongnu.org; Wed, 08 Mar 2023 06:20:10 -0500 Received: from i7.infradead.org ([2001:8b0:10b:1:21e:67ff:fecb:7a92]) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pZrpr-00HMr7-2k; Wed, 08 Mar 2023 11:19:56 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1pZrpq-00BS0Z-0K; Wed, 08 Mar 2023 11:19:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=yEUf8NsPtAfK86nZD4LzsdOV1m7cdo90l6wQAWDLNl0=; b=nps++KGJ4YSMI3bD+B9GzHjIVH YZ0zrTkzfiikytEAcqicf+ZtRUhTzbyzYVR5S3ljVk0whm1ICDc5qhRLDrmaOnUrvXs38McyEHLAb 7TRh1WShYiK3g84nRRAxBUUZfsKZ0mlvNoFROojnIvMSBGyufoyRUTCdAEhz/gmdZ7Ey+QnpHhtvh nt4QK5sqi9NdyJ2jkDP3ZSK4vWA2poef56lmaYYz3sv52KKYJBRi4sH8tfe/iCpEUlMgfSJgtSARH mR2yKBNoUT+YwzmEvkGb72NGBxnyEHXI8rFoT/Jj4FbbXRO2HrzJa+0CtfWIpDz8e0pQkFRzLDn2z M/R/cviw==; From: David Woodhouse To: qemu-devel@nongnu.org Cc: Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal , Paolo Bonzini , Paul Durrant , "Michael S. Tsirkin" , Peter Xu Subject: [PATCH v2 1/3] hw/intc/ioapic: Update KVM routes before redelivering IRQ, on RTE update Date: Wed, 8 Mar 2023 11:19:50 +0000 Message-Id: <20230308111952.2728440-2-dwmw2@infradead.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230308111952.2728440-1-dwmw2@infradead.org> References: <20230308111952.2728440-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+9591d7c4daecea4c87af+7136+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1678274470004100001 Content-Type: text/plain; charset="utf-8" A Linux guest will perform IRQ migration after the IRQ has happened, updating the RTE to point to the new destination CPU and then unmasking the interrupt. However, when the guest updates the RTE, ioapic_mem_write() calls ioapic_service(), which redelivers the pending level interrupt via kvm_set_irq(), *before* calling ioapic_update_kvm_routes() which sets the new target CPU. Thus, the IRQ which is supposed to go to the new target CPU is instead misdelivered to the previous target. An example where the guest kernel is attempting to migrate from CPU#2 to CPU#0 shows: xenstore_read tx 0 path control/platform-feature-xs_reset_watches ioapic_set_irq vector: 11 level: 1 ioapic_set_remote_irr set remote irr for pin 11 ioapic_service: trigger KVM IRQ 11 [ 0.523627] The affinity mask was 0-3 and the handler is on 2 ioapic_mem_write ioapic mem write addr 0x0 regsel: 0x27 size 0x4 val 0x26 ioapic_update_kvm_routes: update KVM route for IRQ 11: fee02000 8021 ioapic_mem_write ioapic mem write addr 0x10 regsel: 0x26 size 0x4 val 0x180= 21 xenstore_reset_watches ioapic_set_irq vector: 11 level: 1 ioapic_mem_read ioapic mem read addr 0x10 regsel: 0x26 size 0x4 retval 0x1c= 021 [ 0.524569] ioapic_ack_level IRQ 11 moveit =3D 1 ioapic_eoi_broadcast EOI broadcast for vector 33 ioapic_clear_remote_irr clear remote irr for pin 11 vector 33 ioapic_mem_write ioapic mem write addr 0x0 regsel: 0x26 size 0x4 val 0x26 ioapic_mem_read ioapic mem read addr 0x10 regsel: 0x26 size 0x4 retval 0x18= 021 [ 0.525235] ioapic_finish_move IRQ 11 calls irq_move_masked_irq() [ 0.526147] irq_do_set_affinity for IRQ 11, 0 [ 0.526732] ioapic_set_affinity for IRQ 11, 0 [ 0.527330] ioapic_setup_msg_from_msi for IRQ11 target 0 ioapic_mem_write ioapic mem write addr 0x0 regsel: 0x26 size 0x4 val 0x27 ioapic_mem_write ioapic mem write addr 0x10 regsel: 0x27 size 0x4 val 0x0 ioapic_mem_write ioapic mem write addr 0x0 regsel: 0x27 size 0x4 val 0x26 ioapic_mem_write ioapic mem write addr 0x10 regsel: 0x26 size 0x4 val 0x180= 21 [ 0.527623] ioapic_set_affinity returns 0 [ 0.527623] ioapic_finish_move IRQ 11 calls unmask_ioapic_irq() ioapic_mem_write ioapic mem write addr 0x0 regsel: 0x26 size 0x4 val 0x26 ioapic_mem_write ioapic mem write addr 0x10 regsel: 0x26 size 0x4 val 0x8021 ioapic_set_remote_irr set remote irr for pin 11 ioapic_service: trigger KVM IRQ 11 ioapic_update_kvm_routes: update KVM route for IRQ 11: fee00000 8021 [ 0.529571] The affinity mask was 0 and the handler is on 2 [ xenstore_watch path memory/target token FFFFFFFF92847D40 There are no other code paths in ioapic_mem_write() which need the KVM IRQ routing table to be updated, so just shift the call from the end of the function to happen right before the call to ioapic_service() and thus deliver the re-enabled IRQ to the right place. Alternative fixes might have been just to remove the part in ioapic_service() which delivers the IRQ via kvm_set_irq() because surely delivering as MSI ought to work just fine anyway in all cases? That code lacks a comment justifying its existence. Or maybe in the specific case shown in the above log, it would have sufficed for ioapic_update_kvm_routes() to update the route *even* when the IRQ is masked. It's not like it's actually going to get triggered unless QEMU deliberately does so, anyway? But that only works because the target CPU happens to be in the high word of the RTE; if something in the *low* word (vector, perhaps) was changed at the same time as the unmask, we'd still trigger with stale data. Fixes: 15eafc2e602f "kvm: x86: add support for KVM_CAP_SPLIT_IRQCHIP" Signed-off-by: David Woodhouse Reviewed-by: Peter Xu --- hw/intc/ioapic.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c index 6364ecab1b..716ffc8bbb 100644 --- a/hw/intc/ioapic.c +++ b/hw/intc/ioapic.c @@ -405,6 +405,7 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t va= l, s->ioredtbl[index] |=3D ro_bits; s->irq_eoi[index] =3D 0; ioapic_fix_edge_remote_irr(&s->ioredtbl[index]); + ioapic_update_kvm_routes(s); ioapic_service(s); } } @@ -417,8 +418,6 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t va= l, ioapic_eoi_broadcast(val); break; } - - ioapic_update_kvm_routes(s); } =20 static const MemoryRegionOps ioapic_io_ops =3D { --=20 2.39.0 From nobody Mon May 6 22:59:49 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1678274452140833.8301929362943; Wed, 8 Mar 2023 03:20:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZrq8-0005bi-AG; Wed, 08 Mar 2023 06:20:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZrq5-0005as-B7 for qemu-devel@nongnu.org; Wed, 08 Mar 2023 06:20:09 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZrq2-0005z8-Us for qemu-devel@nongnu.org; Wed, 08 Mar 2023 06:20:09 -0500 Received: from i7.infradead.org ([2001:8b0:10b:1:21e:67ff:fecb:7a92]) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZrpr-007LC2-Nl; Wed, 08 Mar 2023 11:19:56 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1pZrpq-00BS0c-0V; Wed, 08 Mar 2023 11:19:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=JdP2312WoOZhLmXW7+UuT4K6GVXGf/m2n3vir6Waq1Q=; b=pAY8tZvyyi6eyGeA9aa+3k/SlP 9vsIGyAKin7rV6Seu3Z8cMDARV+5qBgKLFw+AcLhZhhV1x8jxU8lW9THwbVGOrsYh/Zn+hFidPrrZ fbyuJJwqzvGbKxJjwnAi6lvYOuY94NIM0iRkl5yZKydHiBQw2WL2yuRmIbi+K98usUwC2CZA8/c+w hYDKVLhCUu7eX0ZQX849fOBvu+r3bkIVvLim8gTCmlhPCvZmU+L0mQ2sJCGctz0lV77yiQU0ui229 5nVvDChiki3KHP8j9Q0rbf0GFEyuoJT03iwpiQrKA1E5cjYW1KVk+9f2j8rmEJBWUBqjSH1ZpkwBz EznZ5gEw==; From: David Woodhouse To: qemu-devel@nongnu.org Cc: Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal , Paolo Bonzini , Paul Durrant , "Michael S. Tsirkin" , Peter Xu Subject: [PATCH v2 2/3] tests/avocado: Add Fedora 34 distro, including kernel/initrd checksums Date: Wed, 8 Mar 2023 11:19:51 +0000 Message-Id: <20230308111952.2728440-3-dwmw2@infradead.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230308111952.2728440-1-dwmw2@infradead.org> References: <20230308111952.2728440-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+b2970772c949732b78af+7136+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1678274454967100001 Content-Type: text/plain; charset="utf-8" From: David Woodhouse The kernel in Fedora 31 doesn't support 'xen_no_vector_callback' on its command line, so add a slightly newer version as a prelude to enabling avocado tests for Xen guests. Signed-off-by: David Woodhouse --- tests/avocado/avocado_qemu/__init__.py | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado= _qemu/__init__.py index a313e88c07..49e414e267 100644 --- a/tests/avocado/avocado_qemu/__init__.py +++ b/tests/avocado/avocado_qemu/__init__.py @@ -485,6 +485,23 @@ class LinuxDistro: ' console=3Dtty0'), }, }, + '34': { + 'x86_64': + {'checksum': ('b9b621b26725ba95442d9a56cbaa0547' + '84e0779a9522ec6eafff07c6e6f717ea'), + 'pxeboot_url': ('https://archives.fedoraproject.org/' + 'pub/archive/fedora/linux/releases/34/' + 'Everything/x86_64/os/images/pxeboot/'), + 'kernel_hash': ('085fc6e47f2e3a271b591f3e56739ca9' + '4c16718837a5f431ab95468e1e95f9eb'), + 'initrd_hash': ('d6cd2e03e8188eed6c896fd65ff05f81' + '2c4c1c8777d630b5909e9a1a4627e337'), + 'kernel_params': ('root=3DUUID=3D386769a3-cfa5-47c8-8797-' + 'd5ec58c9cb6c ro no_timer_check ' + 'net.ifnames=3D0 console=3Dtty1 ' + 'console=3DttyS0,115200n8'), + }, + }, } } =20 @@ -513,6 +530,16 @@ def pxeboot_url(self): """Gets the repository url where pxeboot files can be found""" return self._info.get('pxeboot_url', None) =20 + @property + def kernel_hash(self): + """Gets checksum of the pxeboot kernel image""" + return self._info.get('kernel_hash', None) + + @property + def initrd_hash(self): + """Gets checksum of the pxeboot initrd image""" + return self._info.get('initrd_hash', None) + @property def default_kernel_params(self): """Gets the default kernel parameters""" --=20 2.39.0 From nobody Mon May 6 22:59:49 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1678274477252734.2971151842916; Wed, 8 Mar 2023 03:21:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZrqA-0005cK-32; Wed, 08 Mar 2023 06:20:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZrq6-0005b5-1K for qemu-devel@nongnu.org; Wed, 08 Mar 2023 06:20:10 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZrq2-0005z9-UW for qemu-devel@nongnu.org; Wed, 08 Mar 2023 06:20:09 -0500 Received: from i7.infradead.org ([2001:8b0:10b:1:21e:67ff:fecb:7a92]) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZrpr-007LC1-Nq; Wed, 08 Mar 2023 11:19:56 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1pZrpq-00BS0f-0g; Wed, 08 Mar 2023 11:19:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description; bh=yk3CWDzezOtspV1Ni7+e/wU61A40IWX1RKy/wSVLnao=; b=j7TzJEKtystmMvU8WiWXcI3kKW LYGQuHHtUIDXP3Vh60/iTs4HiwLYRZYaEXHK5Qe73IVY6ZgGcYTSW3DegGD1mndBtlXWIx1n9i7XF +Z65iv1SqQqcQJH0tPaK9tNo9mVJ8LbgGPxIYB96KEZSej/5uCBo/sOdYo4j0koc1ZETCfMMCOpTJ +ew37vKxUWCsLnwKgttmsHH3oVlmONegBRZr2sLp0Y7P9AxfsljZ4Y0XfIIZ2EEDGJXhHnOGjKmkv V3usHQ+XKW+Po70V87wF0bAmm5EueDkvSXhlHOKjEZ0ilLRFHk1j/ggeFpNBkZvIZq9gA7bcxLkne pvqKhM5g==; From: David Woodhouse To: qemu-devel@nongnu.org Cc: Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal , Paolo Bonzini , Paul Durrant , "Michael S. Tsirkin" , Peter Xu Subject: [PATCH v2 3/3] tests/avocado: Test Xen guest support under KVM Date: Wed, 8 Mar 2023 11:19:52 +0000 Message-Id: <20230308111952.2728440-4-dwmw2@infradead.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230308111952.2728440-1-dwmw2@infradead.org> References: <20230308111952.2728440-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+b2970772c949732b78af+7136+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1678274478063100001 From: David Woodhouse Exercise guests with a few different modes for interrupt delivery. In particular we want to cover: =E2=80=A2 Xen event channel delivery via GSI to the I/O APIC =E2=80=A2 Xen event channel delivery via GSI to the i8259 PIC =E2=80=A2 MSIs routed to PIRQ event channels =E2=80=A2 GSIs routed to PIRQ event channels As well as some variants of normal non-Xen stuff like MSI to vAPIC and PCI INTx going to the I/O APIC and PIC, which ought to still work even in Xen mode. Signed-off-by: David Woodhouse --- tests/avocado/xen_guest.py | 147 +++++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 tests/avocado/xen_guest.py diff --git a/tests/avocado/xen_guest.py b/tests/avocado/xen_guest.py new file mode 100644 index 0000000000..c50b52958f --- /dev/null +++ b/tests/avocado/xen_guest.py @@ -0,0 +1,147 @@ +# Xen guest functional tests +# +# Copyright =C2=A9 2021 Red Hat, Inc. +# Copyright =C2=A9 2023 Amazon.com, Inc. or its affiliates. All Rights Res= erved. +# +# Author: +# David Woodhouse +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. +import os + +from avocado import skipIf +from avocado_qemu import LinuxTest + +@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab') +class XenGuest(LinuxTest): + """ + :avocado: tags=3Darch:x86_64 + :avocado: tags=3Ddistro:fedora + :avocado: tags=3Ddistro_version:34 + :avocado: tags=3Dmachine:q35 + :avocado: tags=3Daccel:kvm + :avocado: tags=3Dxen_guest + """ + + kernel_path =3D None + initrd_path =3D None + kernel_params =3D None + + def set_up_boot(self): + path =3D self.download_boot() + self.vm.add_args('-drive', 'file=3D%s,if=3Dnone,id=3Ddrv0' % path) + self.vm.add_args('-device', 'xen-disk,drive=3Ddrv0,vdev=3Dxvda') + + def setUp(self): + super(XenGuest, self).setUp(None, 'virtio-net-pci') + + def common_vm_setup(self, custom_kernel=3DNone): + self.require_accelerator("kvm") + self.vm.add_args("-accel", "kvm,xen-version=3D0x4000a,kernel-irqch= ip=3Dsplit") + self.vm.add_args("-smp", "4") + + if custom_kernel is None: + return + + kernel_url =3D self.distro.pxeboot_url + 'vmlinuz' + initrd_url =3D self.distro.pxeboot_url + 'initrd.img' + self.kernel_path =3D self.fetch_asset(kernel_url, algorithm=3D'sha= 256', + asset_hash=3Dself.distro.kerne= l_hash) + self.initrd_path =3D self.fetch_asset(initrd_url, algorithm=3D'sha= 256', + asset_hash=3Dself.distro.initr= d_hash) + + def run_and_check(self): + if self.kernel_path: + self.vm.add_args('-kernel', self.kernel_path, + '-append', self.kernel_params, + '-initrd', self.initrd_path) + self.launch_and_wait() + self.ssh_command('cat /proc/cmdline') + self.ssh_command('dmesg | grep -e "Grant table initialized"') + + def test_xen_guest(self): + """ + :avocado: tags=3Dxen_guest + """ + + self.common_vm_setup(True) + + self.kernel_params =3D (self.distro.default_kernel_params + + ' xen_emul_unplug=3Dide-disks') + self.run_and_check() + self.ssh_command('grep xen-pirq.*msi /proc/interrupts') + + def test_xen_guest_nomsi(self): + """ + :avocado: tags=3Dxen_guest_nomsi + """ + + self.common_vm_setup(True) + + self.kernel_params =3D (self.distro.default_kernel_params + + ' xen_emul_unplug=3Dide-disks pci=3Dnomsi') + self.run_and_check() + self.ssh_command('grep xen-pirq.* /proc/interrupts') + + def test_xen_guest_noapic_nomsi(self): + """ + :avocado: tags=3Dxen_guest_noapic_nomsi + """ + + self.common_vm_setup(True) + + self.kernel_params =3D (self.distro.default_kernel_params + + ' xen_emul_unplug=3Dide-disks noapic pci=3Dn= omsi') + self.run_and_check() + self.ssh_command('grep xen-pirq /proc/interrupts') + + def test_xen_guest_vapic(self): + """ + :avocado: tags=3Dxen_guest_vapic + """ + + self.common_vm_setup(True) + self.vm.add_args('-cpu', 'host,+xen-vapic') + self.kernel_params =3D (self.distro.default_kernel_params + + ' xen_emul_unplug=3Dide-disks') + self.run_and_check() + self.ssh_command('grep xen-pirq /proc/interrupts') + self.ssh_command('grep PCI-MSI /proc/interrupts') + + def test_xen_guest_novector(self): + """ + :avocado: tags=3Dxen_guest_novector + """ + + self.common_vm_setup(True) + self.kernel_params =3D (self.distro.default_kernel_params + + ' xen_emul_unplug=3Dide-disks' + + ' xen_no_vector_callback') + self.run_and_check() + self.ssh_command('grep xen-platform-pci /proc/interrupts') + + def test_xen_guest_novector_nomsi(self): + """ + :avocado: tags=3Dxen_guest_novector_nomsi + """ + + self.common_vm_setup(True) + + self.kernel_params =3D (self.distro.default_kernel_params + + ' xen_emul_unplug=3Dide-disks pci=3Dnomsi' + + ' xen_no_vector_callback') + self.run_and_check() + self.ssh_command('grep xen-platform-pci /proc/interrupts') + + def test_xen_guest_novector_noapic(self): + """ + :avocado: tags=3Dxen_guest_novector_noapic + """ + + self.common_vm_setup(True) + self.kernel_params =3D (self.distro.default_kernel_params + + ' xen_emul_unplug=3Dide-disks' + + ' xen_no_vector_callback noapic') + self.run_and_check() + self.ssh_command('grep xen-platform-pci /proc/interrupts') --=20 2.39.0