From nobody Mon Feb 9 06:49:54 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1597842588; cv=none; d=zohomail.com; s=zohoarc; b=E52uncA9KlD5qLhgdPdVhjEe8qBu5/H2BmgSuyillXkP+VD6TK43nfB0JJ7Gr819qf6SBfA/EEbna78RY1d4pbndQcC77RhwBmdMzTezjtlULLvs8sLog5Y2IsOUr2YhAZ0YhzMxE1intbh7y4bhiFQzqmzBXHrdH1hhexQbs0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597842588; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=34GUuY2m+lZ2JpZED8Z+wEsgS3JtpJhHVhCNOOawWwU=; b=VnsCgGNn8nA8RIcIN/pZQtdLrmiF0dFzHLBD0z9l/IrTfl3F8dZNBpSlHJJ8sNVLAMLG5OuBd1ZxYm0t52E52p6fgLNqggFXjgHUF2xdqEi1AO3MTWWl35ohj2Occb36awqYYTjyDSI0jxrPvLMvUwHsrR2i/dKxoPt1Md62ulQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=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 1597842588653542.4456142141872; Wed, 19 Aug 2020 06:09:48 -0700 (PDT) Received: from localhost ([::1]:40360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8Nqd-0006Uf-64 for importer@patchew.org; Wed, 19 Aug 2020 09:09:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8Npl-0004sb-Kd; Wed, 19 Aug 2020 09:08:53 -0400 Received: from smtpout1.mo529.mail-out.ovh.net ([178.32.125.2]:56181) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8Npj-0006LG-DW; Wed, 19 Aug 2020 09:08:53 -0400 Received: from mxplan5.mail.ovh.net (unknown [10.108.20.48]) by mo529.mail-out.ovh.net (Postfix) with ESMTPS id 4C1DF51EFC69; Wed, 19 Aug 2020 15:08:48 +0200 (CEST) Received: from kaod.org (37.59.142.98) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 19 Aug 2020 15:08:47 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-98R0025ea54756-2229-4e8c-9abe-a16a990f0f54, 56ABA3BD09B5898CED80C8E013D4E39E9C6048D1) smtp.auth=clg@kaod.org From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH 1/8] spapr/xive: Add a 'hv-prio' property to represent the KVM escalation priority Date: Wed, 19 Aug 2020 15:08:36 +0200 Message-ID: <20200819130843.2230799-2-clg@kaod.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200819130843.2230799-1-clg@kaod.org> References: <20200819130843.2230799-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.98] X-ClientProxiedBy: DAG2EX1.mxp5.local (172.16.2.11) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 0e746071-b9c8-4da6-8e3b-cb7d7c648407 X-Ovh-Tracer-Id: 2621094985544862502 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduiedruddtkedggeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfhisehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecuggftrfgrthhtvghrnhepheehfeegjeeitdfffeetjeduveejueefuefgtdefueelueetveeliefhhffgtdelnecukfhppedtrddtrddtrddtpdefjedrheelrddugedvrdelkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehmgihplhgrnhehrdhmrghilhdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtoheptghlgheskhgrohgurdhorhhg 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.32.125.2; envelope-from=clg@kaod.org; helo=smtpout1.mo529.mail-out.ovh.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/19 09:08:48 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-ppc@nongnu.org, Greg Kurz , Gustavo Romero Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" On POWER9, the KVM XIVE device uses priority 7 for the escalation interrupts. On POWER10, the host can use a reduced set of priorities and KVM will configure the escalation priority to a lower number. In any case, the guest is allowed to use priorities in a single range : [ 0 .. (maxprio - 1) ]. Introduce a 'hv-prio' property to represent the escalation priority number and use it to compute the "ibm,plat-res-int-priorities" property defining the priority ranges reserved by the hypervisor. Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ppc/spapr_xive.h | 2 ++ hw/intc/spapr_xive.c | 33 ++++++++++++++------------------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h index 0ffbe0be0280..1dddcbcb9cdd 100644 --- a/include/hw/ppc/spapr_xive.h +++ b/include/hw/ppc/spapr_xive.h @@ -49,6 +49,8 @@ typedef struct SpaprXive { void *tm_mmap; MemoryRegion tm_mmio_kvm; VMChangeStateEntry *change; + + uint8_t hv_prio; } SpaprXive; =20 typedef struct SpaprXiveClass { diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index 4bd0d606ba17..1fa09f287ac0 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -595,6 +595,7 @@ static Property spapr_xive_properties[] =3D { DEFINE_PROP_UINT32("nr-ends", SpaprXive, nr_ends, 0), DEFINE_PROP_UINT64("vc-base", SpaprXive, vc_base, SPAPR_XIVE_VC_BASE), DEFINE_PROP_UINT64("tm-base", SpaprXive, tm_base, SPAPR_XIVE_TM_BASE), + DEFINE_PROP_UINT8("hv-prio", SpaprXive, hv_prio, 7), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -692,12 +693,13 @@ static void spapr_xive_dt(SpaprInterruptController *i= ntc, uint32_t nr_servers, cpu_to_be32(16), /* 64K */ }; /* - * The following array is in sync with the reserved priorities - * defined by the 'spapr_xive_priority_is_reserved' routine. + * QEMU/KVM only needs to define a single range to reserve the + * escalation priority. A priority bitmask would have been more + * appropriate. */ uint32_t plat_res_int_priorities[] =3D { - cpu_to_be32(7), /* start */ - cpu_to_be32(0xf8), /* count */ + cpu_to_be32(xive->hv_prio), /* start */ + cpu_to_be32(0xff - xive->hv_prio), /* count */ }; =20 /* Thread Interrupt Management Area : User (ring 3) and OS (ring 2) */ @@ -844,19 +846,12 @@ type_init(spapr_xive_register_types) */ =20 /* - * Linux hosts under OPAL reserve priority 7 for their own escalation - * interrupts (DD2.X POWER9). So we only allow the guest to use - * priorities [0..6]. + * On POWER9, the KVM XIVE device uses priority 7 for the escalation + * interrupts. So we only allow the guest to use priorities [0..6]. */ -static bool spapr_xive_priority_is_reserved(uint8_t priority) +static bool spapr_xive_priority_is_reserved(SpaprXive *xive, uint8_t prior= ity) { - switch (priority) { - case 0 ... 6: - return false; - case 7: /* OPAL escalation queue */ - default: - return true; - } + return priority >=3D xive->hv_prio; } =20 /* @@ -1053,7 +1048,7 @@ static target_ulong h_int_set_source_config(PowerPCCP= U *cpu, new_eas.w =3D eas.w & cpu_to_be64(~EAS_MASKED); } =20 - if (spapr_xive_priority_is_reserved(priority)) { + if (spapr_xive_priority_is_reserved(xive, priority)) { qemu_log_mask(LOG_GUEST_ERROR, "XIVE: priority " TARGET_FMT_ld " is reserved\n", priority); return H_P4; @@ -1212,7 +1207,7 @@ static target_ulong h_int_get_queue_info(PowerPCCPU *= cpu, * This is not needed when running the emulation under QEMU */ =20 - if (spapr_xive_priority_is_reserved(priority)) { + if (spapr_xive_priority_is_reserved(xive, priority)) { qemu_log_mask(LOG_GUEST_ERROR, "XIVE: priority " TARGET_FMT_ld " is reserved\n", priority); return H_P3; @@ -1299,7 +1294,7 @@ static target_ulong h_int_set_queue_config(PowerPCCPU= *cpu, * This is not needed when running the emulation under QEMU */ =20 - if (spapr_xive_priority_is_reserved(priority)) { + if (spapr_xive_priority_is_reserved(xive, priority)) { qemu_log_mask(LOG_GUEST_ERROR, "XIVE: priority " TARGET_FMT_ld " is reserved\n", priority); return H_P3; @@ -1466,7 +1461,7 @@ static target_ulong h_int_get_queue_config(PowerPCCPU= *cpu, * This is not needed when running the emulation under QEMU */ =20 - if (spapr_xive_priority_is_reserved(priority)) { + if (spapr_xive_priority_is_reserved(xive, priority)) { qemu_log_mask(LOG_GUEST_ERROR, "XIVE: priority " TARGET_FMT_ld " is reserved\n", priority); return H_P3; --=20 2.25.4 From nobody Mon Feb 9 06:49:54 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1597842687; cv=none; d=zohomail.com; s=zohoarc; b=fVxh6Bxr9JWm6x8kUg5quqtIXJbulwvaFhl9ZkpLVmb3Ivy8rYZElAYVe9b6TErsUXUEtNT7/+qAJdBsTzY35YdpRXE2TpbyXDtoiYRWKRCx0SzFC/2qGXyAy7EXH2lohpgF72M6P36ISenLj1ryLkGubrccMM0MjYvlSW511kc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597842687; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tjvSvdFujXVsCjpBIbvCjYQKsMvC/Yh50EMS21m/Prg=; b=ms0FnHeNeRb4OGRRyPcam44wvZknp/Xl6O2g3NNlpyc7UYriRr9HHdMZDIk/iuSoGBDVP0F/HYU6MAy77oEsoNfwKOBhbGTHOXzgypv917Budtf04VijVftjTD+yrFhBmCiWJuifHDbe6+oBlj2TaQmRZ84wakJUG+7J9XplsTE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=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 1597842687883534.3127430199338; Wed, 19 Aug 2020 06:11:27 -0700 (PDT) Received: from localhost ([::1]:47864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8NsE-00019f-MW for importer@patchew.org; Wed, 19 Aug 2020 09:11:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8Npm-0004sp-QR; Wed, 19 Aug 2020 09:08:54 -0400 Received: from smtpout1.mo529.mail-out.ovh.net ([178.32.125.2]:58771) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8Npj-0006LI-U1; Wed, 19 Aug 2020 09:08:54 -0400 Received: from mxplan5.mail.ovh.net (unknown [10.108.16.8]) by mo529.mail-out.ovh.net (Postfix) with ESMTPS id A7B4A51EFC7D; Wed, 19 Aug 2020 15:08:49 +0200 (CEST) Received: from kaod.org (37.59.142.98) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 19 Aug 2020 15:08:48 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-98R002b316f480-e9ea-4a06-92ab-092c6af114d4, 56ABA3BD09B5898CED80C8E013D4E39E9C6048D1) smtp.auth=clg@kaod.org From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH 2/8] linux-headers: Update for KVM_DEV_XIVE_GRP_SOURCE_INFO Date: Wed, 19 Aug 2020 15:08:37 +0200 Message-ID: <20200819130843.2230799-3-clg@kaod.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200819130843.2230799-1-clg@kaod.org> References: <20200819130843.2230799-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.98] X-ClientProxiedBy: DAG2EX1.mxp5.local (172.16.2.11) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 03e09e63-567b-4646-a48b-58487daac0e8 X-Ovh-Tracer-Id: 2621376458588523302 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduiedruddtkedggeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfhisehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecuggftrfgrthhtvghrnhepheehfeegjeeitdfffeetjeduveejueefuefgtdefueelueetveeliefhhffgtdelnecukfhppedtrddtrddtrddtpdefjedrheelrddugedvrdelkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehmgihplhgrnhehrdhmrghilhdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtoheptghlgheskhgrohgurdhorhhg 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.32.125.2; envelope-from=clg@kaod.org; helo=smtpout1.mo529.mail-out.ovh.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/19 09:08:48 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-ppc@nongnu.org, Greg Kurz , Gustavo Romero Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" To be sent with the linux-headers update when support is merged. Signed-off-by: C=C3=A9dric Le Goater --- linux-headers/asm-powerpc/kvm.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/linux-headers/asm-powerpc/kvm.h b/linux-headers/asm-powerpc/kv= m.h index 264e266a85bf..aeb8e8c4633b 100644 --- a/linux-headers/asm-powerpc/kvm.h +++ b/linux-headers/asm-powerpc/kvm.h @@ -690,6 +690,7 @@ struct kvm_ppc_cpu_char { #define KVM_DEV_XIVE_GRP_SOURCE_CONFIG 3 /* 64-bit source identifier */ #define KVM_DEV_XIVE_GRP_EQ_CONFIG 4 /* 64-bit EQ identifier */ #define KVM_DEV_XIVE_GRP_SOURCE_SYNC 5 /* 64-bit source identifier */ +#define KVM_DEV_XIVE_GRP_SOURCE_INFO 6 /* 64-bit source identifier */ =20 /* Layout of 64-bit XIVE source attribute values */ #define KVM_XIVE_LEVEL_SENSITIVE (1ULL << 0) @@ -721,6 +722,13 @@ struct kvm_ppc_xive_eq { __u8 pad[40]; }; =20 +#define KVM_XIVE_SOURCE_FLAG_STORE_EOI 0x00000001 + +/* Layout of source characteristics (8 bytes) */ +struct kvm_ppc_xive_src { + __u64 flags; +}; + #define KVM_XIVE_EQ_ALWAYS_NOTIFY 0x00000001 =20 #define KVM_XIVE_TIMA_PAGE_OFFSET 0 --=20 2.25.4 From nobody Mon Feb 9 06:49:54 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1597842680; cv=none; d=zohomail.com; s=zohoarc; b=bDysDcrj9KtOvJRm+2jbtNzlCwJDPcHUJjnwJH4NqPvENS7Ks4yL75Nj96FgBG5X5TXFgB3555Lp5696eV5jIsTyb+CQTXH2UkLHbSAWaTm/MzYNMr4lUcGTLmyMwz7M9RgXNfxgAaTo3rCJBxza+nOHR5rq9QWdZko525BE9yo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597842680; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ogK7z9QA/xbQklSJKs89IqRso/TT/kaIBuIBJU8fc7M=; b=FKt19W+4My9Je+WTzy5vu2Oj9iJ5J8c1opU/4GOr3xE5npthiA7c0pstF0YLlRbuacCVb9lcW1wrY+lmCs8moOpb0DMCWx1n32D+qjwzxOrwZtWMHULVkzoXt01x4s20Bgi47T7Y6Ckce0gTnQg+ZRfwq0pGcZ695c7G3Oua+uo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=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 159784268034730.174294427435825; Wed, 19 Aug 2020 06:11:20 -0700 (PDT) Received: from localhost ([::1]:47102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8Ns6-0000qU-Ut for importer@patchew.org; Wed, 19 Aug 2020 09:11:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8Npo-0004vQ-7O; Wed, 19 Aug 2020 09:08:56 -0400 Received: from smtpout1.mo804.mail-out.ovh.net ([79.137.123.220]:47949) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8Npl-0006LZ-Kj; Wed, 19 Aug 2020 09:08:55 -0400 Received: from mxplan5.mail.ovh.net (unknown [10.109.138.109]) by mo804.mail-out.ovh.net (Postfix) with ESMTPS id E7CD358A0B85; Wed, 19 Aug 2020 15:08:50 +0200 (CEST) Received: from kaod.org (37.59.142.98) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 19 Aug 2020 15:08:49 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-98R002259375a7-0089-4f1c-b548-029e240ac414, 56ABA3BD09B5898CED80C8E013D4E39E9C6048D1) smtp.auth=clg@kaod.org From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH 3/8] spapr/xive: Query the characteristics of a source in KVM Date: Wed, 19 Aug 2020 15:08:38 +0200 Message-ID: <20200819130843.2230799-4-clg@kaod.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200819130843.2230799-1-clg@kaod.org> References: <20200819130843.2230799-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.98] X-ClientProxiedBy: DAG2EX1.mxp5.local (172.16.2.11) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 4720eae0-975a-4a7c-9ab2-40d0d91becbb X-Ovh-Tracer-Id: 2621657936032860966 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduiedruddtkedggeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfhisehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecuggftrfgrthhtvghrnhepheehfeegjeeitdfffeetjeduveejueefuefgtdefueelueetveeliefhhffgtdelnecukfhppedtrddtrddtrddtpdefjedrheelrddugedvrdelkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehmgihplhgrnhehrdhmrghilhdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtoheptghlgheskhgrohgurdhorhhg 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=79.137.123.220; envelope-from=clg@kaod.org; helo=smtpout1.mo804.mail-out.ovh.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/19 09:08:51 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-ppc@nongnu.org, Greg Kurz , Gustavo Romero Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" When running a guest with a kernel IRQ chip enabled, the XIVE characteristics of the interrupts are advertised to the guest in the H_INT_GET_SOURCE_INFO hcall. These characteristics depend on the underlying HW interrupts but today, QEMU simply advertises its own without checking what the host supports. It is not a problem for the moment, but POWER10 will (re)add support for StoreEOI and we need a way to in sync with the host. The KVM_DEV_XIVE_GRP_SOURCE_INFO command lets QEMU query the XIVE characteristics of the underlying HW interrupts and override any previous setting done by QEMU. This allows the fallback mode, when the XIVE device is emulated by QEMU, to use its own custom settings on the sources but makes sure that we don't let a guest run with features incompatible with KVM. It only applies to the StoreEOI feature for the moment. Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ppc/spapr_xive.h | 2 ++ hw/intc/spapr_xive.c | 20 ++++++++++++++++++++ hw/intc/spapr_xive_kvm.c | 26 ++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h index 1dddcbcb9cdd..3f325723ea74 100644 --- a/include/hw/ppc/spapr_xive.h +++ b/include/hw/ppc/spapr_xive.h @@ -84,6 +84,8 @@ void kvmppc_xive_disconnect(SpaprInterruptController *int= c); void kvmppc_xive_reset(SpaprXive *xive, Error **errp); int kvmppc_xive_set_source_config(SpaprXive *xive, uint32_t lisn, XiveEAS = *eas, Error **errp); +int kvmppc_xive_get_source_info(SpaprXive *xive, uint32_t lisn, uint64_t *= flags, + Error **errp); void kvmppc_xive_sync_source(SpaprXive *xive, uint32_t lisn, Error **errp); uint64_t kvmppc_xive_esb_rw(XiveSource *xsrc, int srcno, uint32_t offset, uint64_t data, bool write); diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index 1fa09f287ac0..943b9958a68b 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -932,6 +932,26 @@ static target_ulong h_int_get_source_info(PowerPCCPU *= cpu, args[0] |=3D SPAPR_XIVE_SRC_STORE_EOI; } =20 + if (kvm_irqchip_in_kernel()) { + Error *local_err =3D NULL; + uint64_t flags =3D 0; + + kvmppc_xive_get_source_info(xive, lisn, &flags, &local_err); + if (local_err) { + error_report_err(local_err); + return H_HARDWARE; + } + + /* + * Override QEMU settings with KVM values + */ + if (flags & XIVE_SRC_STORE_EOI) { + args[0] |=3D SPAPR_XIVE_SRC_STORE_EOI; + } else { + args[0] &=3D ~SPAPR_XIVE_SRC_STORE_EOI; + } + } + /* * Force the use of the H_INT_ESB hcall in case of an LSI * interrupt. This is necessary under KVM to re-trigger the diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c index e8667ce5f621..90f4509e6959 100644 --- a/hw/intc/spapr_xive_kvm.c +++ b/hw/intc/spapr_xive_kvm.c @@ -217,6 +217,32 @@ int kvmppc_xive_set_source_config(SpaprXive *xive, uin= t32_t lisn, XiveEAS *eas, &kvm_src, true, errp); } =20 +int kvmppc_xive_get_source_info(SpaprXive *xive, uint32_t lisn, uint64_t *= flags, + Error **errp) +{ + struct kvm_ppc_xive_src kvm_src =3D { 0 }; + int ret; + + /* + * Check that KVM supports the new attribute to query source + * characteristics. + */ + if (!kvm_device_check_attr(xive->fd, KVM_DEV_XIVE_GRP_SOURCE_INFO, 0))= { + return 0; + } + + ret =3D kvm_device_access(xive->fd, KVM_DEV_XIVE_GRP_SOURCE_INFO, lisn, + &kvm_src, false, errp); + if (ret < 0) { + return ret; + } + + if (kvm_src.flags & KVM_XIVE_SOURCE_FLAG_STORE_EOI) { + *flags |=3D XIVE_SRC_STORE_EOI; + } + return 0; +} + void kvmppc_xive_sync_source(SpaprXive *xive, uint32_t lisn, Error **errp) { kvm_device_access(xive->fd, KVM_DEV_XIVE_GRP_SOURCE_SYNC, lisn, --=20 2.25.4 From nobody Mon Feb 9 06:49:54 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1597842769; cv=none; d=zohomail.com; s=zohoarc; b=buEEU6AWZ3tMi+EMU4PHZsir9CvCi0XSXjaizTxpgVuI64p7dsdb5w/OULpN0X55MVja+SF5ScWBIjAsFhRrnJ66p1j0BZBDC24n1rxW2HfDNsDeJkS/kpClXhAXUc9QPQkAqaJcWHRQHeRq0RL+alS/8f1PfDGWHWBkfcVGQ94= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597842769; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NimRfZlZpp56TOU3XtI2IX5wtAEb+2NrjMM8mXnqbx8=; b=EUDUHssdmO6+BjfWNm4A99bOHMSdhxLknpmXHD2uJprDLr51pCl1GqhWhar7W0AUpEw/rysiL+bwDd2EIU2iHgR0HxFXOeTqz6XKySS7Ea3cssefiuNS8p/PTz9VCuaeLsdYWAKdZx4eKsCIZaRyd0fY+56qJwO2e7CshXn12nw= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=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 1597842769219175.23398970264577; Wed, 19 Aug 2020 06:12:49 -0700 (PDT) Received: from localhost ([::1]:51638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8NtX-0002lY-8o for importer@patchew.org; Wed, 19 Aug 2020 09:12:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8Npp-0004yF-6c; Wed, 19 Aug 2020 09:08:57 -0400 Received: from smtpout1.mo804.mail-out.ovh.net ([79.137.123.220]:36813) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8Npl-0006Lq-LV; Wed, 19 Aug 2020 09:08:56 -0400 Received: from mxplan5.mail.ovh.net (unknown [10.109.138.109]) by mo804.mail-out.ovh.net (Postfix) with ESMTPS id 6958258A0B8A; Wed, 19 Aug 2020 15:08:51 +0200 (CEST) Received: from kaod.org (37.59.142.98) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 19 Aug 2020 15:08:50 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-98R00222ed0cb7-28ec-4adb-bcfa-41a54b3a8a55, 56ABA3BD09B5898CED80C8E013D4E39E9C6048D1) smtp.auth=clg@kaod.org From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH 4/8] spapr/xive: Activate StoreEOI for POWER10 only Date: Wed, 19 Aug 2020 15:08:39 +0200 Message-ID: <20200819130843.2230799-5-clg@kaod.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200819130843.2230799-1-clg@kaod.org> References: <20200819130843.2230799-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.98] X-ClientProxiedBy: DAG2EX1.mxp5.local (172.16.2.11) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: a88e599d-486e-4347-8993-cb6e5e2a3057 X-Ovh-Tracer-Id: 2621939408889350950 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduiedruddtkedggeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfhisehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecuggftrfgrthhtvghrnhepheehfeegjeeitdfffeetjeduveejueefuefgtdefueelueetveeliefhhffgtdelnecukfhppedtrddtrddtrddtpdefjedrheelrddugedvrdelkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehmgihplhgrnhehrdhmrghilhdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtoheptghlgheskhgrohgurdhorhhg 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=79.137.123.220; envelope-from=clg@kaod.org; helo=smtpout1.mo804.mail-out.ovh.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/19 09:08:51 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-ppc@nongnu.org, Greg Kurz , Gustavo Romero Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The StoreEOI features is safe to use with a P10 compat machine but not with P9 compat, as it can not be migrated to a P9 host. Introdude a "hw-storeeoi" property in the SpaprXive model to check for the availability of StoreEOI at the HW level when a kernel IRQ chip is in use. XIVE emulated is not impacted. Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ppc/spapr_xive.h | 1 + hw/intc/spapr_xive.c | 3 ++- hw/ppc/spapr_irq.c | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h index 3f325723ea74..402e38a7cf5e 100644 --- a/include/hw/ppc/spapr_xive.h +++ b/include/hw/ppc/spapr_xive.h @@ -51,6 +51,7 @@ typedef struct SpaprXive { VMChangeStateEntry *change; =20 uint8_t hv_prio; + bool hw_storeeoi; } SpaprXive; =20 typedef struct SpaprXiveClass { diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index 943b9958a68b..d184d17e30e7 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -596,6 +596,7 @@ static Property spapr_xive_properties[] =3D { DEFINE_PROP_UINT64("vc-base", SpaprXive, vc_base, SPAPR_XIVE_VC_BASE), DEFINE_PROP_UINT64("tm-base", SpaprXive, tm_base, SPAPR_XIVE_TM_BASE), DEFINE_PROP_UINT8("hv-prio", SpaprXive, hv_prio, 7), + DEFINE_PROP_BOOL("hw-storeeoi", SpaprXive, hw_storeeoi, false), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -945,7 +946,7 @@ static target_ulong h_int_get_source_info(PowerPCCPU *c= pu, /* * Override QEMU settings with KVM values */ - if (flags & XIVE_SRC_STORE_EOI) { + if (xive->hw_storeeoi && flags & XIVE_SRC_STORE_EOI) { args[0] |=3D SPAPR_XIVE_SRC_STORE_EOI; } else { args[0] &=3D ~SPAPR_XIVE_SRC_STORE_EOI; diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 72bb938375ef..80cf1c3d6bb2 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -199,6 +199,23 @@ static int spapr_irq_check(SpaprMachineState *spapr, E= rror **errp) return 0; } =20 +static bool spapr_irq_xive_hw_storeeoi(SpaprMachineState *spapr) +{ + MachineState *machine =3D MACHINE(spapr); + + /* + * All P10 compat kernels should enforce load-after-store ordering + * for StoreEOI. + */ + if (ppc_type_check_compat(machine->cpu_type, CPU_POWERPC_LOGICAL_3_10, + 0, spapr->max_compat_pvr)) { + return true; + } + + /* StoreEOI on P9 compat is unsafe */ + return false; +} + /* * sPAPR IRQ frontend routines for devices */ @@ -325,6 +342,7 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **e= rrp) =20 if (spapr->irq->xive) { uint32_t nr_servers =3D spapr_max_server_number(spapr); + bool storeeoi =3D spapr_irq_xive_hw_storeeoi(spapr); DeviceState *dev; int i; =20 @@ -337,6 +355,8 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **e= rrp) qdev_prop_set_uint32(dev, "nr-ends", nr_servers << 3); object_property_set_link(OBJECT(dev), "xive-fabric", OBJECT(spapr), &error_abort); + object_property_set_bool(OBJECT(dev), "hw-storeeoi", storeeoi, + &error_abort); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 spapr->xive =3D SPAPR_XIVE(dev); --=20 2.25.4 From nobody Mon Feb 9 06:49:54 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1597842609; cv=none; d=zohomail.com; s=zohoarc; b=CUsjqbZdRkoLOo2IdCoPYbsEq7PGQYoUmgtZA5Q0biElrzpuQDntqDuRkkGi9zao48S06Lgr7Vscoyr+DScMv5yYQTjnxSwbZVgClihYhcEctyjmh7qOPGmGNFz6gGtYsgg+rwR8Yu/YHQrjbXP/MT9RLDRkfBLsJqbph86bWJ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597842609; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rHFdIJPePSey1hvj7gYvOObz0j/zSc1Q4piDCQDwqq4=; b=ChqqSKVV6CHwlNmN+7apLEgDTHkXQDK7ICtKpmxvpx6jqf4XO7f7/pFoiyiz8Lq/JoupTCpmFhoHaflKnZnly9g4q96N6Szu9dk06am2IlQRpZod+ty5645jlG61YFyu9C3uErpEHg/B090G09VIRN3H1gO2YZxqAzV0Jnz0fW0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=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 1597842609381390.3119551553136; Wed, 19 Aug 2020 06:10:09 -0700 (PDT) Received: from localhost ([::1]:42224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8Nqx-0007EA-VJ for importer@patchew.org; Wed, 19 Aug 2020 09:10:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8Npp-0004zW-Oo; Wed, 19 Aug 2020 09:08:57 -0400 Received: from smtpout1.mo804.mail-out.ovh.net ([79.137.123.220]:42605) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8Npm-0006MC-JD; Wed, 19 Aug 2020 09:08:57 -0400 Received: from mxplan5.mail.ovh.net (unknown [10.108.20.52]) by mo804.mail-out.ovh.net (Postfix) with ESMTPS id 1416658A0B90; Wed, 19 Aug 2020 15:08:53 +0200 (CEST) Received: from kaod.org (37.59.142.98) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 19 Aug 2020 15:08:51 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-98R002bc53b74f-525f-4d1f-82f7-eb4efdbd18b4, 56ABA3BD09B5898CED80C8E013D4E39E9C6048D1) smtp.auth=clg@kaod.org From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH 5/8] spapr/xive: Enforce the load-after-store ordering Date: Wed, 19 Aug 2020 15:08:40 +0200 Message-ID: <20200819130843.2230799-6-clg@kaod.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200819130843.2230799-1-clg@kaod.org> References: <20200819130843.2230799-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.98] X-ClientProxiedBy: DAG2EX1.mxp5.local (172.16.2.11) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 9a811dae-fe7a-4c1a-8e37-e9cbf6abbc66 X-Ovh-Tracer-Id: 2622220883518982950 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduiedruddtkedggeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfhisehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecuggftrfgrthhtvghrnhepheehfeegjeeitdfffeetjeduveejueefuefgtdefueelueetveeliefhhffgtdelnecukfhppedtrddtrddtrddtpdefjedrheelrddugedvrdelkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehmgihplhgrnhehrdhmrghilhdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtoheptghlgheskhgrohgurdhorhhg 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=79.137.123.220; envelope-from=clg@kaod.org; helo=smtpout1.mo804.mail-out.ovh.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/19 09:08:51 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-ppc@nongnu.org, Greg Kurz , Gustavo Romero Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The XIVE_ESB_SET_PQ_10 load operation is used to disable temporarily an interrupt source. If StoreEOI is active, a source could be left enabled if the load and store operations come out of order. QEMU makes use of this offset to quiesce the sources before a migration. Enforce the load-after-store ordering always when doing so without querying the characteristics of the sources on the host. The performance penalty will be very small for QEMU. Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ppc/xive.h | 8 ++++++++ hw/intc/spapr_xive_kvm.c | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h index 2c42ae92d287..c061230ea802 100644 --- a/include/hw/ppc/xive.h +++ b/include/hw/ppc/xive.h @@ -279,6 +279,14 @@ static inline hwaddr xive_source_esb_mgmt(XiveSource *= xsrc, int srcno) #define XIVE_ESB_SET_PQ_10 0xe00 /* Load */ #define XIVE_ESB_SET_PQ_11 0xf00 /* Load */ =20 +/* + * Load-after-store ordering + * + * Adding this offset to the load address will enforce + * load-after-store ordering. This is required to use with StoreEOI. + */ +#define XIVE_ESB_LD_ST_MO 0x40 /* Load-after-store ordering */ + uint8_t xive_source_esb_get(XiveSource *xsrc, uint32_t srcno); uint8_t xive_source_esb_set(XiveSource *xsrc, uint32_t srcno, uint8_t pq); =20 diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c index 90f4509e6959..3eea4cb1c49f 100644 --- a/hw/intc/spapr_xive_kvm.c +++ b/hw/intc/spapr_xive_kvm.c @@ -317,6 +317,18 @@ static uint64_t xive_esb_rw(XiveSource *xsrc, int srcn= o, uint32_t offset, =20 static uint8_t xive_esb_read(XiveSource *xsrc, int srcno, uint32_t offset) { + /* + * The XIVE_ESB_SET_PQ_10 load operation is used to disable + * temporarily an interrupt source. If StoreEOI is active, a + * source could be left enabled if the load and store operations + * come out of order. + * + * Enforce the load-after-store ordering always. + */ + if (offset =3D=3D XIVE_ESB_SET_PQ_10) { + offset |=3D XIVE_ESB_LD_ST_MO; + } + return xive_esb_rw(xsrc, srcno, offset, 0, 0) & 0x3; } =20 --=20 2.25.4 From nobody Mon Feb 9 06:49:54 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1597842819; cv=none; d=zohomail.com; s=zohoarc; b=fBYI0/Y4khxzqzFGmDwYWjjw3JNuMYzN8lSU7Nz3iDk9J7RfNUlRTo+ZL1/E/3iPQkouQ1ETr4AOM0L9slZRR7vz+UQ7ohM7tj+3vrayB3LQyEpzTmHVj+z56/UE+1AsCEl6ieM4yL8sCIifO/5meH6bCsIB9Io1mxBoSfTllvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597842819; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=emWMMPOue8a9MC/U703IcC/G6Z2ESEO7tR5GM44yf08=; b=US8WMqb7Vpn8LB300FJIS+GhBzwBLt3bXSj2F3YSVZTe7fM7FIcwBUheDPGLJtW3afw+fu8D85oaQtlgHoxpTKNUTJkg3g7kEUKj4le8pL1GdHhFbG9mtxHMwhkxnkcQymGkE82iEWzROVwXWDO8tW75r3XmE0SBHgOUXOYg82Y= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=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 1597842819443797.2471091902936; Wed, 19 Aug 2020 06:13:39 -0700 (PDT) Received: from localhost ([::1]:54652 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8NuM-000417-2k for importer@patchew.org; Wed, 19 Aug 2020 09:13:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8Npp-0004zE-L2; Wed, 19 Aug 2020 09:08:57 -0400 Received: from smtpout1.mo529.mail-out.ovh.net ([178.32.125.2]:35831) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8Npn-0006MK-BC; Wed, 19 Aug 2020 09:08:57 -0400 Received: from mxplan5.mail.ovh.net (unknown [10.108.4.132]) by mo529.mail-out.ovh.net (Postfix) with ESMTPS id B8A9751EFCEC; Wed, 19 Aug 2020 15:08:53 +0200 (CEST) Received: from kaod.org (37.59.142.98) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 19 Aug 2020 15:08:52 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-98R002d4123a5f-776a-4f23-ab7a-ea07fe7d48d0, 56ABA3BD09B5898CED80C8E013D4E39E9C6048D1) smtp.auth=clg@kaod.org From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH 6/8] spapr/xive: Activate StoreEOI by default Date: Wed, 19 Aug 2020 15:08:41 +0200 Message-ID: <20200819130843.2230799-7-clg@kaod.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200819130843.2230799-1-clg@kaod.org> References: <20200819130843.2230799-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.98] X-ClientProxiedBy: DAG2EX1.mxp5.local (172.16.2.11) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: fea85eb6-4b7d-4e1d-86f2-8414154be364 X-Ovh-Tracer-Id: 2622502360479861542 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduiedruddtkedggeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfhisehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecuggftrfgrthhtvghrnhepheehfeegjeeitdfffeetjeduveejueefuefgtdefueelueetveeliefhhffgtdelnecukfhppedtrddtrddtrddtpdefjedrheelrddugedvrdelkeenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehmgihplhgrnhehrdhmrghilhdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtoheptghlgheskhgrohgurdhorhhg 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.32.125.2; envelope-from=clg@kaod.org; helo=smtpout1.mo529.mail-out.ovh.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/19 09:08:48 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-ppc@nongnu.org, Greg Kurz , Gustavo Romero Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Now that we check the XIVE characteristics of the sources at the KVM level, we can configure the sources to use StoreEOI by default. This feature will be activated for the emulated mode and possibly for KVM also if compatible. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/spapr_xive.c | 2 ++ hw/intc/xive.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index d184d17e30e7..e0765c0de696 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -317,6 +317,8 @@ static void spapr_xive_realize(DeviceState *dev, Error = **errp) */ object_property_set_int(OBJECT(xsrc), "nr-irqs", xive->nr_irqs, &error_fatal); + object_property_set_int(OBJECT(xsrc), "flags", XIVE_SRC_STORE_EOI, + &error_fatal); object_property_set_link(OBJECT(xsrc), "xive", OBJECT(xive), &error_ab= ort); if (!qdev_realize(DEVICE(xsrc), NULL, errp)) { return; diff --git a/hw/intc/xive.c b/hw/intc/xive.c index 489e6256ef70..b710ba2df095 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -998,6 +998,12 @@ static uint64_t xive_source_esb_read(void *opaque, hwa= ddr addr, unsigned size) case XIVE_ESB_SET_PQ_01 ... XIVE_ESB_SET_PQ_01 + 0x0FF: case XIVE_ESB_SET_PQ_10 ... XIVE_ESB_SET_PQ_10 + 0x0FF: case XIVE_ESB_SET_PQ_11 ... XIVE_ESB_SET_PQ_11 + 0x0FF: + if (offset =3D=3D XIVE_ESB_SET_PQ_10 && + xsrc->esb_flags & XIVE_SRC_STORE_EOI) { + qemu_log_mask(LOG_GUEST_ERROR, "XIVE: load-after-store orderin= g " + "not enforced with Store EOI active for IRQ %d\n= ", + srcno); + } ret =3D xive_source_esb_set(xsrc, srcno, (offset >> 8) & 0x3); break; default: --=20 2.25.4 From nobody Mon Feb 9 06:49:54 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1597842891; cv=none; d=zohomail.com; s=zohoarc; b=ZDJSq97SxT8WuNcTcNBrsql9D1Ec3R5OjdOLz5FE9a0TXn78MvbfLhNLPvJ1OE1f+xkQZKxTKAZGd7KXElxMWYiLW4NGfN6VwMQenRZ4s/ZtSbh0pVy1iJO3egNlCHpdq/J3ZpnL+eGKpxaFDwiVaGIImMkOzDj8bDEH9VzpnXI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597842891; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3HSw5TF7dCpWH6ptHJ9B0pdGAjdsML5VsygIAFh42RY=; b=KRfVqQmorOgvH+aBPDTyPvknG3hMZ3jeIC1X7QixNR3HgWtQtmV26uRgv4kaPXu1rVR58SCk1QlkpKHWHda4NdLhEKMZ8s8ur36xoL/tylAMA2amJWALdlkBnVgvF3tCBLqeCLCDp0Uksni6Cugh7whj4Z+h/bHAKq/r12Fu0ZI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=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 1597842891067323.4332306604788; Wed, 19 Aug 2020 06:14:51 -0700 (PDT) Received: from localhost ([::1]:56686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8NvV-0004u4-QW for importer@patchew.org; Wed, 19 Aug 2020 09:14:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8Npq-00050C-0r; Wed, 19 Aug 2020 09:08:58 -0400 Received: from smtpout1.mo804.mail-out.ovh.net ([79.137.123.220]:55567) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8Npo-0006Md-8z; Wed, 19 Aug 2020 09:08:57 -0400 Received: from mxplan5.mail.ovh.net (unknown [10.108.20.173]) by mo804.mail-out.ovh.net (Postfix) with ESMTPS id A0BE758A0B9B; Wed, 19 Aug 2020 15:08:54 +0200 (CEST) Received: from kaod.org (37.59.142.98) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 19 Aug 2020 15:08:53 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-98R002d599fcee-7de0-45a8-bbc0-75def4c89134, 56ABA3BD09B5898CED80C8E013D4E39E9C6048D1) smtp.auth=clg@kaod.org From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH 7/8] spapr/xive: Use the xics flag to check for XIVE-only IRQ backends Date: Wed, 19 Aug 2020 15:08:42 +0200 Message-ID: <20200819130843.2230799-8-clg@kaod.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200819130843.2230799-1-clg@kaod.org> References: <20200819130843.2230799-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.98] X-ClientProxiedBy: DAG2EX1.mxp5.local (172.16.2.11) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 06a969b4-eb6f-4d43-a7c8-200a079076c4 X-Ovh-Tracer-Id: 2622783835270122278 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduiedruddtkedggeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfhisehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecuggftrfgrthhtvghrnhepheehfeegjeeitdfffeetjeduveejueefuefgtdefueelueetveeliefhhffgtdelnecukfhppedtrddtrddtrddtpdefjedrheelrddugedvrdelkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehmgihplhgrnhehrdhmrghilhdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtoheptghlgheskhgrohgurdhorhhg 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=79.137.123.220; envelope-from=clg@kaod.org; helo=smtpout1.mo804.mail-out.ovh.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/19 09:08:51 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-ppc@nongnu.org, Greg Kurz , Gustavo Romero Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: C=C3=A9dric Le Goater --- hw/ppc/spapr_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 80cf1c3d6bb2..d036c8fef519 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -172,7 +172,7 @@ static int spapr_irq_check(SpaprMachineState *spapr, Er= ror **errp) * To cover both and not confuse the OS, add an early failure in * QEMU. */ - if (spapr->irq =3D=3D &spapr_irq_xive) { + if (!spapr->irq->xics) { error_setg(errp, "XIVE-only machines require a POWER9 CPU"); return -1; } --=20 2.25.4 From nobody Mon Feb 9 06:49:54 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1597842949; cv=none; d=zohomail.com; s=zohoarc; b=UEwoC/Z4Nr6L2ZBy/K9k1HiP1oGBcW2MwGIQ9+oLagCMWCZmHN+v7fhQ7z3Bvd/K4+nEbJVISVf67bVi1L9dWNxkSVGExsixx2oK0wt8txcTIXYrwlBDrZn8Hc07431LaBXHDLP1WcIdBuqaov12mjOjQIeQxjsszrvKL4S0CZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597842949; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LcHkK8xIpmJc95upzUkXZY0ss1Hx31R0E9NDEC2+3L8=; b=LqTxEMq9ijNjsnONU2Uk0Vg4xFOGImFHBRpzwm3We4MO0aiqRBTnm9o9PRK+WgZuL5yykulUBm9wIpfI9C1w5U7ssRLFJty4Fy+kUo0Nzw/c2iEdENFujJKt7Gr+U5njgBDSMZFrL2EQ8mGJLykRMd3azzuvuMuGjgwbVpf62QY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=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 1597842949572922.2953319559925; Wed, 19 Aug 2020 06:15:49 -0700 (PDT) Received: from localhost ([::1]:58736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8NwS-0005rB-Bo for importer@patchew.org; Wed, 19 Aug 2020 09:15:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8Npr-00055I-Lv; Wed, 19 Aug 2020 09:08:59 -0400 Received: from smtpout1.mo529.mail-out.ovh.net ([178.32.125.2]:46331) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8Npp-0006Mv-US; Wed, 19 Aug 2020 09:08:59 -0400 Received: from mxplan5.mail.ovh.net (unknown [10.108.20.10]) by mo529.mail-out.ovh.net (Postfix) with ESMTPS id 15D3F51EFD31; Wed, 19 Aug 2020 15:08:56 +0200 (CEST) Received: from kaod.org (37.59.142.98) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 19 Aug 2020 15:08:54 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-98R00262a691de-efbb-447f-b2d2-3f782b00fa18, 56ABA3BD09B5898CED80C8E013D4E39E9C6048D1) smtp.auth=clg@kaod.org From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH 8/8] spapr/xive: Introduce a XIVE StoreEOI IRQ backend Date: Wed, 19 Aug 2020 15:08:43 +0200 Message-ID: <20200819130843.2230799-9-clg@kaod.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200819130843.2230799-1-clg@kaod.org> References: <20200819130843.2230799-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.98] X-ClientProxiedBy: DAG2EX1.mxp5.local (172.16.2.11) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 21d15091-42c4-4934-a479-09f3442ea952 X-Ovh-Tracer-Id: 2623346785664338727 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduiedruddtkedggeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfhisehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecuggftrfgrthhtvghrnhepheehfeegjeeitdfffeetjeduveejueefuefgtdefueelueetveeliefhhffgtdelnecukfhppedtrddtrddtrddtpdefjedrheelrddugedvrdelkeenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehmgihplhgrnhehrdhmrghilhdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtoheptghlgheskhgrohgurdhorhhg 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.32.125.2; envelope-from=clg@kaod.org; helo=smtpout1.mo529.mail-out.ovh.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/19 09:08:48 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-ppc@nongnu.org, Greg Kurz , Gustavo Romero Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" As it is still useful to run a P9 compat guest with StoreEOI enabled, introduce a new IRQ backend to allow that. May be we should add a migration blocker. Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ppc/spapr_irq.h | 1 + hw/ppc/spapr.c | 6 +++++- hw/ppc/spapr_irq.c | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/hw/ppc/spapr_irq.h b/include/hw/ppc/spapr_irq.h index ca8cb4421374..548895a89cca 100644 --- a/include/hw/ppc/spapr_irq.h +++ b/include/hw/ppc/spapr_irq.h @@ -90,6 +90,7 @@ typedef struct SpaprIrq { extern SpaprIrq spapr_irq_xics; extern SpaprIrq spapr_irq_xics_legacy; extern SpaprIrq spapr_irq_xive; +extern SpaprIrq spapr_irq_xive_storeeoi; extern SpaprIrq spapr_irq_dual; =20 void spapr_irq_init(SpaprMachineState *spapr, Error **errp); diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index a5bb0736e237..23f26d50f598 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3248,6 +3248,8 @@ static char *spapr_get_ic_mode(Object *obj, Error **e= rrp) return g_strdup("xics"); } else if (spapr->irq =3D=3D &spapr_irq_xive) { return g_strdup("xive"); + } else if (spapr->irq =3D=3D &spapr_irq_xive_storeeoi) { + return g_strdup("xive-storeeoi"); } else if (spapr->irq =3D=3D &spapr_irq_dual) { return g_strdup("dual"); } @@ -3268,6 +3270,8 @@ static void spapr_set_ic_mode(Object *obj, const char= *value, Error **errp) spapr->irq =3D &spapr_irq_xics; } else if (strcmp(value, "xive") =3D=3D 0) { spapr->irq =3D &spapr_irq_xive; + } else if (strcmp(value, "xive-storeeoi") =3D=3D 0) { + spapr->irq =3D &spapr_irq_xive_storeeoi; } else if (strcmp(value, "dual") =3D=3D 0) { spapr->irq =3D &spapr_irq_dual; } else { @@ -3350,7 +3354,7 @@ static void spapr_instance_init(Object *obj) object_property_add_str(obj, "ic-mode", spapr_get_ic_mode, spapr_set_ic_mode); object_property_set_description(obj, "ic-mode", - "Specifies the interrupt controller mode (xics, xive, dua= l)"); + "Specifies the interrupt controller mode (xics, xive, xiv= e-storeeoi, dual)"); =20 object_property_add_str(obj, "host-model", spapr_get_host_model, spapr_set_host_model); diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index d036c8fef519..c2e83fd0b34d 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -119,6 +119,15 @@ SpaprIrq spapr_irq_xive =3D { .xive =3D true, }; =20 +/* + * XIVE IRQ backend + StoreEOI activated + */ + +SpaprIrq spapr_irq_xive_storeeoi =3D { + .xics =3D false, + .xive =3D true, +}; + /* * Dual XIVE and XICS IRQ backend. * @@ -213,6 +222,11 @@ static bool spapr_irq_xive_hw_storeeoi(SpaprMachineSta= te *spapr) } =20 /* StoreEOI on P9 compat is unsafe */ + if (spapr->irq =3D=3D &spapr_irq_xive_storeeoi) { + warn_report("HW Store EOI on a POWER9 CPU is unsafe."); + return true; + } + return false; } =20 --=20 2.25.4