From patchwork Fri Nov 20 17:46:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 11921455 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBAB2C2D0E4 for ; Fri, 20 Nov 2020 17:51:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 299B622240 for ; Fri, 20 Nov 2020 17:51:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 299B622240 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kaod.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kgAZg-0005k2-Vy for qemu-devel@archiver.kernel.org; Fri, 20 Nov 2020 12:51:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgAV5-0008UQ-Bk for qemu-devel@nongnu.org; Fri, 20 Nov 2020 12:47:14 -0500 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:57426) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kgAV2-00057T-IT for qemu-devel@nongnu.org; Fri, 20 Nov 2020 12:47:11 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-96-V5AcIn0DNTi4B4PYRgb2-A-1; Fri, 20 Nov 2020 12:46:51 -0500 X-MC-Unique: V5AcIn0DNTi4B4PYRgb2-A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5095B80ED8A; Fri, 20 Nov 2020 17:46:50 +0000 (UTC) Received: from bahia.redhat.com (ovpn-112-44.ams2.redhat.com [10.36.112.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id C44735C1D5; Fri, 20 Nov 2020 17:46:48 +0000 (UTC) From: Greg Kurz To: qemu-devel@nongnu.org Subject: [PATCH for-6.0 1/8] spapr/xive: Turn some sanity checks into assertions Date: Fri, 20 Nov 2020 18:46:39 +0100 Message-Id: <20201120174646.619395-2-groug@kaod.org> In-Reply-To: <20201120174646.619395-1-groug@kaod.org> References: <20201120174646.619395-1-groug@kaod.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=groug@kaod.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kaod.org Received-SPF: softfail client-ip=205.139.111.44; envelope-from=groug@kaod.org; helo=us-smtp-delivery-44.mimecast.com X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no 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: Greg Kurz , qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric_L?= =?utf-8?q?e_Goater?= , David Gibson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The sPAPR XIVE device is created by the machine in spapr_irq_init(). The latter overrides any value provided by the user with -global for the "nr-irqs" and "nr-ends" properties with strictly positive values. It seems reasonable to assume these properties should never be 0, which wouldn't make much sense by the way. Signed-off-by: Greg Kurz Reviewed-by: Cédric Le Goater --- hw/intc/spapr_xive.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index 1fa09f287ac0..60e0d5769dcc 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -296,22 +296,16 @@ static void spapr_xive_realize(DeviceState *dev, Error **errp) XiveENDSource *end_xsrc = &xive->end_source; Error *local_err = NULL; + /* Set by spapr_irq_init() */ + g_assert(xive->nr_irqs); + g_assert(xive->nr_ends); + sxc->parent_realize(dev, &local_err); if (local_err) { error_propagate(errp, local_err); return; } - if (!xive->nr_irqs) { - error_setg(errp, "Number of interrupt needs to be greater 0"); - return; - } - - if (!xive->nr_ends) { - error_setg(errp, "Number of interrupt needs to be greater 0"); - return; - } - /* * Initialize the internal sources, for IPIs and virtual devices. */ From patchwork Fri Nov 20 17:46:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 11921461 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 429AAC2D0E4 for ; Fri, 20 Nov 2020 17:54:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 598192240B for ; Fri, 20 Nov 2020 17:54:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 598192240B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kaod.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kgAcD-0000jg-9c for qemu-devel@archiver.kernel.org; Fri, 20 Nov 2020 12:54:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgAV4-0008UJ-KZ for qemu-devel@nongnu.org; Fri, 20 Nov 2020 12:47:14 -0500 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:58220) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kgAV2-00057J-I2 for qemu-devel@nongnu.org; Fri, 20 Nov 2020 12:47:09 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-381-DYWRbe43PmCKn5it_ST3jg-1; Fri, 20 Nov 2020 12:46:53 -0500 X-MC-Unique: DYWRbe43PmCKn5it_ST3jg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C4A76107AD29; Fri, 20 Nov 2020 17:46:51 +0000 (UTC) Received: from bahia.redhat.com (ovpn-112-44.ams2.redhat.com [10.36.112.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C24B5C1D5; Fri, 20 Nov 2020 17:46:50 +0000 (UTC) From: Greg Kurz To: qemu-devel@nongnu.org Subject: [PATCH for-6.0 2/8] spapr/xive: Introduce spapr_xive_nr_ends() Date: Fri, 20 Nov 2020 18:46:40 +0100 Message-Id: <20201120174646.619395-3-groug@kaod.org> In-Reply-To: <20201120174646.619395-1-groug@kaod.org> References: <20201120174646.619395-1-groug@kaod.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=groug@kaod.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kaod.org Received-SPF: softfail client-ip=207.211.30.44; envelope-from=groug@kaod.org; helo=us-smtp-delivery-44.mimecast.com X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no 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: Greg Kurz , qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric_L?= =?utf-8?q?e_Goater?= , David Gibson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We're going to kill the "nr_ends" field in a subsequent patch. Prepare ground by using an helper instead of peeking into the sPAPR XIVE structure directly. Signed-off-by: Greg Kurz --- include/hw/ppc/spapr_xive.h | 1 + hw/intc/spapr_xive.c | 23 ++++++++++++++--------- hw/intc/spapr_xive_kvm.c | 4 ++-- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h index 26c8d90d7196..4b967f13c030 100644 --- a/include/hw/ppc/spapr_xive.h +++ b/include/hw/ppc/spapr_xive.h @@ -75,6 +75,7 @@ void spapr_xive_map_mmio(SpaprXive *xive); int spapr_xive_end_to_target(uint8_t end_blk, uint32_t end_idx, uint32_t *out_server, uint8_t *out_prio); +uint32_t spapr_xive_nr_ends(const SpaprXive *xive); /* * KVM XIVE device helpers diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index 60e0d5769dcc..f473ad9cba47 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -192,7 +192,7 @@ void spapr_xive_pic_print_info(SpaprXive *xive, Monitor *mon) uint32_t end_idx = xive_get_field64(EAS_END_INDEX, eas->w); XiveEND *end; - assert(end_idx < xive->nr_ends); + assert(end_idx < spapr_xive_nr_ends(xive)); end = &xive->endt[end_idx]; if (xive_end_is_valid(end)) { @@ -270,7 +270,7 @@ static void spapr_xive_reset(void *dev) } /* Clear all ENDs */ - for (i = 0; i < xive->nr_ends; i++) { + for (i = 0; i < spapr_xive_nr_ends(xive); i++) { spapr_xive_end_reset(&xive->endt[i]); } } @@ -288,6 +288,11 @@ static void spapr_xive_instance_init(Object *obj) xive->fd = -1; } +uint32_t spapr_xive_nr_ends(const SpaprXive *xive) +{ + return xive->nr_ends; +} + static void spapr_xive_realize(DeviceState *dev, Error **errp) { SpaprXive *xive = SPAPR_XIVE(dev); @@ -336,7 +341,7 @@ static void spapr_xive_realize(DeviceState *dev, Error **errp) * Allocate the routing tables */ xive->eat = g_new0(XiveEAS, xive->nr_irqs); - xive->endt = g_new0(XiveEND, xive->nr_ends); + xive->endt = g_new0(XiveEND, spapr_xive_nr_ends(xive)); xive->nodename = g_strdup_printf("interrupt-controller@%" PRIx64, xive->tm_base + XIVE_TM_USER_PAGE * (1 << TM_SHIFT)); @@ -375,7 +380,7 @@ static int spapr_xive_get_end(XiveRouter *xrtr, { SpaprXive *xive = SPAPR_XIVE(xrtr); - if (end_idx >= xive->nr_ends) { + if (end_idx >= spapr_xive_nr_ends(xive)) { return -1; } @@ -389,7 +394,7 @@ static int spapr_xive_write_end(XiveRouter *xrtr, uint8_t end_blk, { SpaprXive *xive = SPAPR_XIVE(xrtr); - if (end_idx >= xive->nr_ends) { + if (end_idx >= spapr_xive_nr_ends(xive)) { return -1; } @@ -1138,7 +1143,7 @@ static target_ulong h_int_get_source_config(PowerPCCPU *cpu, /* EAS_END_BLOCK is unused on sPAPR */ end_idx = xive_get_field64(EAS_END_INDEX, eas.w); - assert(end_idx < xive->nr_ends); + assert(end_idx < spapr_xive_nr_ends(xive)); end = &xive->endt[end_idx]; nvt_blk = xive_get_field32(END_W6_NVT_BLOCK, end->w6); @@ -1216,7 +1221,7 @@ static target_ulong h_int_get_queue_info(PowerPCCPU *cpu, return H_P2; } - assert(end_idx < xive->nr_ends); + assert(end_idx < spapr_xive_nr_ends(xive)); end = &xive->endt[end_idx]; args[0] = xive->end_base + (1ull << (end_xsrc->esb_shift + 1)) * end_idx; @@ -1304,7 +1309,7 @@ static target_ulong h_int_set_queue_config(PowerPCCPU *cpu, return H_P2; } - assert(end_idx < xive->nr_ends); + assert(end_idx < spapr_xive_nr_ends(xive)); memcpy(&end, &xive->endt[end_idx], sizeof(XiveEND)); switch (qsize) { @@ -1470,7 +1475,7 @@ static target_ulong h_int_get_queue_config(PowerPCCPU *cpu, return H_P2; } - assert(end_idx < xive->nr_ends); + assert(end_idx < spapr_xive_nr_ends(xive)); end = &xive->endt[end_idx]; args[0] = 0; diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c index 66bf4c06fe55..1566016f0e28 100644 --- a/hw/intc/spapr_xive_kvm.c +++ b/hw/intc/spapr_xive_kvm.c @@ -531,7 +531,7 @@ static int kvmppc_xive_get_queues(SpaprXive *xive, Error **errp) int i; int ret; - for (i = 0; i < xive->nr_ends; i++) { + for (i = 0; i < spapr_xive_nr_ends(xive); i++) { if (!xive_end_is_valid(&xive->endt[i])) { continue; } @@ -701,7 +701,7 @@ int kvmppc_xive_post_load(SpaprXive *xive, int version_id) assert(xive->fd != -1); /* Restore the ENDT first. The targetting depends on it. */ - for (i = 0; i < xive->nr_ends; i++) { + for (i = 0; i < spapr_xive_nr_ends(xive); i++) { if (!xive_end_is_valid(&xive->endt[i])) { continue; } From patchwork Fri Nov 20 17:46:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 11921447 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 549A2C56201 for ; Fri, 20 Nov 2020 17:50:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A82D822240 for ; Fri, 20 Nov 2020 17:49:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A82D822240 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kaod.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:41870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kgAXm-0003Gm-O9 for qemu-devel@archiver.kernel.org; Fri, 20 Nov 2020 12:49:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55240) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgAV4-0008UK-Ks for qemu-devel@nongnu.org; Fri, 20 Nov 2020 12:47:14 -0500 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:31230) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kgAUw-00058h-Ur for qemu-devel@nongnu.org; Fri, 20 Nov 2020 12:47:10 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-467-Wx5zvgiBNhq2AqZzyYiYSw-1; Fri, 20 Nov 2020 12:46:54 -0500 X-MC-Unique: Wx5zvgiBNhq2AqZzyYiYSw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4634D80ED8A; Fri, 20 Nov 2020 17:46:53 +0000 (UTC) Received: from bahia.redhat.com (ovpn-112-44.ams2.redhat.com [10.36.112.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DA3B5C1D5; Fri, 20 Nov 2020 17:46:51 +0000 (UTC) From: Greg Kurz To: qemu-devel@nongnu.org Subject: [PATCH for-6.0 3/8] spapr/xive: Add "nr-servers" property Date: Fri, 20 Nov 2020 18:46:41 +0100 Message-Id: <20201120174646.619395-4-groug@kaod.org> In-Reply-To: <20201120174646.619395-1-groug@kaod.org> References: <20201120174646.619395-1-groug@kaod.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kaod.org Received-SPF: softfail client-ip=207.211.30.44; envelope-from=groug@kaod.org; helo=us-smtp-delivery-44.mimecast.com X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no 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: Greg Kurz , qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric_L?= =?utf-8?q?e_Goater?= , David Gibson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The sPAPR XIVE object has an "nr-ends" property that is used to size the END table. This property is set by the machine code to a value derived from spapr_max_server_number(). spapr_max_server_number() is also used to inform the KVM XIVE device about the range of vCPU ids it might be exposed to, in order to optimize resource allocation in the HW. This is enough motivation to introduce an "nr-servers" property and to use it for both purposes. The existing "nr-ends" property is now longer used. It is kept around though because it is exposed to -global. It will continue to be ignored as before without causing QEMU to exit. The associated nr_ends field cannot be dropped from SpaprXive because it is explicitly used by vmstate_spapr_xive(). It is thus renamed to nr_ends_vmstate. Signed-off-by: Greg Kurz --- include/hw/ppc/spapr_xive.h | 16 +++++++++++++++- hw/intc/spapr_xive.c | 28 ++++++++++++++++++++++------ hw/ppc/spapr_irq.c | 6 +----- 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h index 4b967f13c030..7123ea07ed78 100644 --- a/include/hw/ppc/spapr_xive.h +++ b/include/hw/ppc/spapr_xive.h @@ -23,6 +23,16 @@ typedef struct SpaprXive { XiveRouter parent; + /* + * The XIVE device needs to know the highest vCPU id it might + * be exposed to in order to size the END table. It may also + * propagate the value to the KVM XIVE device in order to + * optimize resource allocation in the HW. + * This must be set to a non-null value using the "nr-servers" + * property, before realizing the device. + */ + uint32_t nr_servers; + /* Internal interrupt source for IPIs and virtual devices */ XiveSource source; hwaddr vc_base; @@ -38,7 +48,11 @@ typedef struct SpaprXive { XiveEAS *eat; uint32_t nr_irqs; XiveEND *endt; - uint32_t nr_ends; + /* + * This is derived from nr_servers but it must be kept around because + * vmstate_spapr_xive uses it. + */ + uint32_t nr_ends_vmstate; /* TIMA mapping address */ hwaddr tm_base; diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index f473ad9cba47..e4dbf9c2c409 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -99,6 +99,12 @@ int spapr_xive_end_to_target(uint8_t end_blk, uint32_t end_idx, return 0; } +/* + * 8 XIVE END structures per CPU. One for each available + * priority + */ +#define spapr_xive_cpu_end_idx(vcpu, prio) (((vcpu) << 3) + prio) + static void spapr_xive_cpu_to_end(PowerPCCPU *cpu, uint8_t prio, uint8_t *out_end_blk, uint32_t *out_end_idx) { @@ -109,7 +115,7 @@ static void spapr_xive_cpu_to_end(PowerPCCPU *cpu, uint8_t prio, } if (out_end_idx) { - *out_end_idx = (cpu->vcpu_id << 3) + prio; + *out_end_idx = spapr_xive_cpu_end_idx(cpu->vcpu_id, prio); } } @@ -290,7 +296,8 @@ static void spapr_xive_instance_init(Object *obj) uint32_t spapr_xive_nr_ends(const SpaprXive *xive) { - return xive->nr_ends; + g_assert(xive->nr_servers); + return spapr_xive_cpu_end_idx(xive->nr_servers, 0); } static void spapr_xive_realize(DeviceState *dev, Error **errp) @@ -303,7 +310,7 @@ static void spapr_xive_realize(DeviceState *dev, Error **errp) /* Set by spapr_irq_init() */ g_assert(xive->nr_irqs); - g_assert(xive->nr_ends); + g_assert(xive->nr_servers); sxc->parent_realize(dev, &local_err); if (local_err) { @@ -360,6 +367,8 @@ static void spapr_xive_realize(DeviceState *dev, Error **errp) sysbus_mmio_map(SYS_BUS_DEVICE(xive), 0, xive->vc_base); sysbus_mmio_map(SYS_BUS_DEVICE(xive), 1, xive->end_base); sysbus_mmio_map(SYS_BUS_DEVICE(xive), 2, xive->tm_base); + + xive->nr_ends_vmstate = spapr_xive_nr_ends(xive); } static int spapr_xive_get_eas(XiveRouter *xrtr, uint8_t eas_blk, @@ -547,7 +556,7 @@ static const VMStateDescription vmstate_spapr_xive = { VMSTATE_UINT32_EQUAL(nr_irqs, SpaprXive, NULL), VMSTATE_STRUCT_VARRAY_POINTER_UINT32(eat, SpaprXive, nr_irqs, vmstate_spapr_xive_eas, XiveEAS), - VMSTATE_STRUCT_VARRAY_POINTER_UINT32(endt, SpaprXive, nr_ends, + VMSTATE_STRUCT_VARRAY_POINTER_UINT32(endt, SpaprXive, nr_ends_vmstate, vmstate_spapr_xive_end, XiveEND), VMSTATE_END_OF_LIST() }, @@ -591,7 +600,14 @@ static void spapr_xive_free_irq(SpaprInterruptController *intc, int lisn) static Property spapr_xive_properties[] = { DEFINE_PROP_UINT32("nr-irqs", SpaprXive, nr_irqs, 0), - DEFINE_PROP_UINT32("nr-ends", SpaprXive, nr_ends, 0), + /* + * "nr-ends" is deprecated by "nr-servers" since QEMU 6.0. + * It is just kept around because it is exposed to the user + * through -global and we don't want it to fail, even if + * the value is actually overridden internally. + */ + DEFINE_PROP_UINT32("nr-ends", SpaprXive, nr_ends_vmstate, 0), + DEFINE_PROP_UINT32("nr-servers", SpaprXive, nr_servers, 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), @@ -742,7 +758,7 @@ static int spapr_xive_activate(SpaprInterruptController *intc, SpaprXive *xive = SPAPR_XIVE(intc); if (kvm_enabled()) { - int rc = spapr_irq_init_kvm(kvmppc_xive_connect, intc, nr_servers, + int rc = spapr_irq_init_kvm(kvmppc_xive_connect, intc, xive->nr_servers, errp); if (rc < 0) { return rc; diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index f59960339ec3..8c5627225636 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -330,11 +330,7 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **errp) dev = qdev_new(TYPE_SPAPR_XIVE); qdev_prop_set_uint32(dev, "nr-irqs", smc->nr_xirqs + SPAPR_XIRQ_BASE); - /* - * 8 XIVE END structures per CPU. One for each available - * priority - */ - qdev_prop_set_uint32(dev, "nr-ends", nr_servers << 3); + qdev_prop_set_uint32(dev, "nr-servers", nr_servers); object_property_set_link(OBJECT(dev), "xive-fabric", OBJECT(spapr), &error_abort); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); From patchwork Fri Nov 20 17:46:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 11921443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67E0DC56201 for ; Fri, 20 Nov 2020 17:48:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BCED222240 for ; Fri, 20 Nov 2020 17:48:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BCED222240 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kaod.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kgAWm-0001mk-Cw for qemu-devel@archiver.kernel.org; Fri, 20 Nov 2020 12:48:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55090) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgAUv-0008Qx-Oc for qemu-devel@nongnu.org; Fri, 20 Nov 2020 12:47:02 -0500 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:58736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kgAUt-000588-UW for qemu-devel@nongnu.org; Fri, 20 Nov 2020 12:47:01 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-538-WD4bcnprPv-SeQuirOs03g-1; Fri, 20 Nov 2020 12:46:56 -0500 X-MC-Unique: WD4bcnprPv-SeQuirOs03g-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BA6FB1DDEE; Fri, 20 Nov 2020 17:46:54 +0000 (UTC) Received: from bahia.redhat.com (ovpn-112-44.ams2.redhat.com [10.36.112.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 926BF5C1D5; Fri, 20 Nov 2020 17:46:53 +0000 (UTC) From: Greg Kurz To: qemu-devel@nongnu.org Subject: [PATCH for-6.0 4/8] spapr/xive: Add "nr-ipis" property Date: Fri, 20 Nov 2020 18:46:42 +0100 Message-Id: <20201120174646.619395-5-groug@kaod.org> In-Reply-To: <20201120174646.619395-1-groug@kaod.org> References: <20201120174646.619395-1-groug@kaod.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=groug@kaod.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kaod.org Received-SPF: softfail client-ip=205.139.111.44; envelope-from=groug@kaod.org; helo=us-smtp-delivery-44.mimecast.com X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no 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: Greg Kurz , qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric_L?= =?utf-8?q?e_Goater?= , David Gibson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The sPAPR XIVE device exposes a range of LISNs that the guest uses for IPIs. This range is currently sized according to the highest vCPU id, ie. spapr_max_server_number(), as obtained from the machine through the "nr_servers" argument of the generic spapr_irq_dt() call. This makes sense for the "ibm,interrupt-server-ranges" property of sPAPR XICS, but certainly not for "ibm,xive-lisn-ranges". The range should be sized to the maximum number of possible vCPUs. It happens that spapr_max_server_number() == smp.max_cpus in practice with the machine default settings. This might not be the case though when VSMT is in use : we can end up with a much larger range (up to 8 times bigger) than needed and waste LISNs. But most importantly, this lures people into thinking that IPI numbers are always equal to vCPU ids, which is wrong and bit us recently: https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg01476.html Introduce an "nr-ipis" property that the machine sets to smp.max_cpus before realizing the deice. Use that instead of "nr_servers" in spapr_xive_dt(). Have the machine to claim the same number of IPIs in spapr_irq_init(). This doesn't cause any guest visible change when using the machine default settings (ie. VSMT == smp.threads). Signed-off-by: Greg Kurz Reviewed-by: David Gibson --- include/hw/ppc/spapr_xive.h | 8 ++++++++ hw/intc/spapr_xive.c | 4 +++- hw/ppc/spapr_irq.c | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h index 7123ea07ed78..69b9fbc1b9a5 100644 --- a/include/hw/ppc/spapr_xive.h +++ b/include/hw/ppc/spapr_xive.h @@ -43,6 +43,14 @@ typedef struct SpaprXive { /* DT */ gchar *nodename; + /* + * The sPAPR XIVE device needs to know how many vCPUs it + * might be exposed to in order to size the IPI range in + * "ibm,interrupt-server-ranges". It is the purpose of the + * "nr-ipis" property which *must* be set to a non-null + * value before realizing the sPAPR XIVE device. + */ + uint32_t nr_ipis; /* Routing table */ XiveEAS *eat; diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index e4dbf9c2c409..d13a2955ce9b 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -311,6 +311,7 @@ static void spapr_xive_realize(DeviceState *dev, Error **errp) /* Set by spapr_irq_init() */ g_assert(xive->nr_irqs); g_assert(xive->nr_servers); + g_assert(xive->nr_ipis); sxc->parent_realize(dev, &local_err); if (local_err) { @@ -608,6 +609,7 @@ static Property spapr_xive_properties[] = { */ DEFINE_PROP_UINT32("nr-ends", SpaprXive, nr_ends_vmstate, 0), DEFINE_PROP_UINT32("nr-servers", SpaprXive, nr_servers, 0), + DEFINE_PROP_UINT32("nr-ipis", SpaprXive, nr_ipis, 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), @@ -698,7 +700,7 @@ static void spapr_xive_dt(SpaprInterruptController *intc, uint32_t nr_servers, /* Interrupt number ranges for the IPIs */ uint32_t lisn_ranges[] = { cpu_to_be32(SPAPR_IRQ_IPI), - cpu_to_be32(SPAPR_IRQ_IPI + nr_servers), + cpu_to_be32(SPAPR_IRQ_IPI + xive->nr_ipis), }; /* * EQ size - the sizes of pages supported by the system 4K, 64K, diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 8c5627225636..a0fc474ecb06 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -325,12 +325,14 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **errp) if (spapr->irq->xive) { uint32_t nr_servers = spapr_max_server_number(spapr); + uint32_t max_cpus = MACHINE(spapr)->smp.max_cpus; DeviceState *dev; int i; dev = qdev_new(TYPE_SPAPR_XIVE); qdev_prop_set_uint32(dev, "nr-irqs", smc->nr_xirqs + SPAPR_XIRQ_BASE); qdev_prop_set_uint32(dev, "nr-servers", nr_servers); + qdev_prop_set_uint32(dev, "nr-ipis", max_cpus); object_property_set_link(OBJECT(dev), "xive-fabric", OBJECT(spapr), &error_abort); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); @@ -338,7 +340,7 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **errp) spapr->xive = SPAPR_XIVE(dev); /* Enable the CPU IPIs */ - for (i = 0; i < nr_servers; ++i) { + for (i = 0; i < max_cpus; ++i) { SpaprInterruptControllerClass *sicc = SPAPR_INTC_GET_CLASS(spapr->xive); From patchwork Fri Nov 20 17:46:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 11921445 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90826C63777 for ; Fri, 20 Nov 2020 17:49:50 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 06D4D22240 for ; Fri, 20 Nov 2020 17:49:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06D4D22240 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kaod.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:41398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kgAXd-00034e-0j for qemu-devel@archiver.kernel.org; Fri, 20 Nov 2020 12:49:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgAUx-0008RS-6N for qemu-devel@nongnu.org; Fri, 20 Nov 2020 12:47:07 -0500 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:39261) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kgAUt-00058D-Vl for qemu-devel@nongnu.org; Fri, 20 Nov 2020 12:47:02 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-281-tYPiPneZMIixWPmnIleXWw-1; Fri, 20 Nov 2020 12:46:57 -0500 X-MC-Unique: tYPiPneZMIixWPmnIleXWw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 40F0610051C6; Fri, 20 Nov 2020 17:46:56 +0000 (UTC) Received: from bahia.redhat.com (ovpn-112-44.ams2.redhat.com [10.36.112.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 131BD5C1D5; Fri, 20 Nov 2020 17:46:54 +0000 (UTC) From: Greg Kurz To: qemu-devel@nongnu.org Subject: [PATCH for-6.0 5/8] spapr/xics: Drop unused argument to xics_kvm_has_broken_disconnect() Date: Fri, 20 Nov 2020 18:46:43 +0100 Message-Id: <20201120174646.619395-6-groug@kaod.org> In-Reply-To: <20201120174646.619395-1-groug@kaod.org> References: <20201120174646.619395-1-groug@kaod.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=groug@kaod.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kaod.org Received-SPF: softfail client-ip=207.211.30.44; envelope-from=groug@kaod.org; helo=us-smtp-delivery-44.mimecast.com X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no 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: Greg Kurz , qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric_L?= =?utf-8?q?e_Goater?= , David Gibson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Never used from the start. Signed-off-by: Greg Kurz Reviewed-by: Cédric Le Goater --- include/hw/ppc/xics_spapr.h | 2 +- hw/intc/xics_kvm.c | 2 +- hw/ppc/spapr_irq.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/hw/ppc/xics_spapr.h b/include/hw/ppc/xics_spapr.h index 0b8182e40b33..de752c0d2c7e 100644 --- a/include/hw/ppc/xics_spapr.h +++ b/include/hw/ppc/xics_spapr.h @@ -38,6 +38,6 @@ DECLARE_INSTANCE_CHECKER(ICSState, ICS_SPAPR, int xics_kvm_connect(SpaprInterruptController *intc, uint32_t nr_servers, Error **errp); void xics_kvm_disconnect(SpaprInterruptController *intc); -bool xics_kvm_has_broken_disconnect(SpaprMachineState *spapr); +bool xics_kvm_has_broken_disconnect(void); #endif /* XICS_SPAPR_H */ diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 68bb1914b9bb..570d635bcc08 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -484,7 +484,7 @@ void xics_kvm_disconnect(SpaprInterruptController *intc) * support destruction of a KVM XICS device while the VM is running. * Required to start a spapr machine with ic-mode=dual,kernel-irqchip=on. */ -bool xics_kvm_has_broken_disconnect(SpaprMachineState *spapr) +bool xics_kvm_has_broken_disconnect(void) { int rc; diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index a0fc474ecb06..2dacbecfd5fd 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -186,7 +186,7 @@ static int spapr_irq_check(SpaprMachineState *spapr, Error **errp) if (kvm_enabled() && spapr->irq == &spapr_irq_dual && kvm_kernel_irqchip_required() && - xics_kvm_has_broken_disconnect(spapr)) { + xics_kvm_has_broken_disconnect()) { error_setg(errp, "KVM is incompatible with ic-mode=dual,kernel-irqchip=on"); error_append_hint(errp, From patchwork Fri Nov 20 17:46:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 11921459 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EC45C56201 for ; Fri, 20 Nov 2020 17:53:12 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 902932240B for ; Fri, 20 Nov 2020 17:53:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 902932240B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kaod.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kgAas-00072o-JP for qemu-devel@archiver.kernel.org; Fri, 20 Nov 2020 12:53:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgAV4-0008UL-MY for qemu-devel@nongnu.org; Fri, 20 Nov 2020 12:47:14 -0500 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:40289) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kgAV2-00058v-Hm for qemu-devel@nongnu.org; Fri, 20 Nov 2020 12:47:10 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-46-uCgy60zVPv-0a9BOzGv59A-1; Fri, 20 Nov 2020 12:46:58 -0500 X-MC-Unique: uCgy60zVPv-0a9BOzGv59A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B1B318030A2; Fri, 20 Nov 2020 17:46:57 +0000 (UTC) Received: from bahia.redhat.com (ovpn-112-44.ams2.redhat.com [10.36.112.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 894D85C1D5; Fri, 20 Nov 2020 17:46:56 +0000 (UTC) From: Greg Kurz To: qemu-devel@nongnu.org Subject: [PATCH for-6.0 6/8] spapr/xics: Add "nr-servers" property Date: Fri, 20 Nov 2020 18:46:44 +0100 Message-Id: <20201120174646.619395-7-groug@kaod.org> In-Reply-To: <20201120174646.619395-1-groug@kaod.org> References: <20201120174646.619395-1-groug@kaod.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=groug@kaod.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kaod.org Received-SPF: softfail client-ip=205.139.111.44; envelope-from=groug@kaod.org; helo=us-smtp-delivery-44.mimecast.com X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no 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: Greg Kurz , qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric_L?= =?utf-8?q?e_Goater?= , David Gibson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The sPAPR ICS device exposes the range of vCPU ids it can handle in the "ibm,interrupt-server-ranges" FDT property. The highest vCPU id, ie. spapr_max_server_number(), is obtained from the machine through the "nr_servers" argument of the generic spapr_irq_dt() call. We want to drop the "nr_servers" argument from the API because it doesn't make sense for the sPAPR XIVE device actually. On POWER9, we also pass the highest vCPU id to the KVM XICS-on-XIVE device, in order to optimize resource allocation in the HW. This is enough motivation to introduce an "nr-servers" property and to use it for both purposes. Signed-off-by: Greg Kurz --- include/hw/ppc/spapr.h | 4 ++-- include/hw/ppc/xics_spapr.h | 21 +++++++++++++++++--- hw/intc/xics_kvm.c | 2 +- hw/intc/xics_spapr.c | 38 ++++++++++++++++++++++++------------- hw/ppc/spapr.c | 5 +++-- hw/ppc/spapr_irq.c | 7 +++++-- 6 files changed, 54 insertions(+), 23 deletions(-) diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 2e89e36cfbdc..b76c84a2f884 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -10,7 +10,7 @@ #include "hw/ppc/spapr_irq.h" #include "qom/object.h" #include "hw/ppc/spapr_xive.h" /* For SpaprXive */ -#include "hw/ppc/xics.h" /* For ICSState */ +#include "hw/ppc/xics_spapr.h" /* For IcsSpaprState */ #include "hw/ppc/spapr_tpm_proxy.h" struct SpaprVioBus; @@ -230,7 +230,7 @@ struct SpaprMachineState { SpaprIrq *irq; qemu_irq *qirqs; SpaprInterruptController *active_intc; - ICSState *ics; + IcsSpaprState *ics; SpaprXive *xive; bool cmd_line_caps[SPAPR_CAP_NUM]; diff --git a/include/hw/ppc/xics_spapr.h b/include/hw/ppc/xics_spapr.h index de752c0d2c7e..1a483a873b62 100644 --- a/include/hw/ppc/xics_spapr.h +++ b/include/hw/ppc/xics_spapr.h @@ -28,12 +28,27 @@ #define XICS_SPAPR_H #include "hw/ppc/spapr.h" +#include "hw/ppc/xics.h" #include "qom/object.h" +typedef struct IcsSpaprState { + /*< private >*/ + ICPState parent_obj; + + /* + * The ICS needs to know the upper limit to vCPU ids it + * might be exposed to in order to size the vCPU id range + * in "ibm,interrupt-server-ranges" and to optimize HW + * resource allocation when using the XICS-on-XIVE KVM + * device. It is the purpose of the "nr-servers" property + * which *must* be set to a non-null value before realizing + * the ICS. + */ + uint32_t nr_servers; +} IcsSpaprState; + #define TYPE_ICS_SPAPR "ics-spapr" -/* This is reusing the ICSState typedef from TYPE_ICS */ -DECLARE_INSTANCE_CHECKER(ICSState, ICS_SPAPR, - TYPE_ICS_SPAPR) +DECLARE_INSTANCE_CHECKER(IcsSpaprState, ICS_SPAPR, TYPE_ICS_SPAPR) int xics_kvm_connect(SpaprInterruptController *intc, uint32_t nr_servers, Error **errp); diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 570d635bcc08..ecbbda0e249b 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -350,7 +350,7 @@ void ics_kvm_set_irq(ICSState *ics, int srcno, int val) int xics_kvm_connect(SpaprInterruptController *intc, uint32_t nr_servers, Error **errp) { - ICSState *ics = ICS_SPAPR(intc); + ICSState *ics = ICS(intc); int rc; CPUState *cs; Error *local_err = NULL; diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c index 8ae4f41459c3..ce147e8980ed 100644 --- a/hw/intc/xics_spapr.c +++ b/hw/intc/xics_spapr.c @@ -34,6 +34,7 @@ #include "hw/ppc/xics.h" #include "hw/ppc/xics_spapr.h" #include "hw/ppc/fdt.h" +#include "hw/qdev-properties.h" #include "qapi/visitor.h" /* @@ -154,7 +155,7 @@ static void rtas_set_xive(PowerPCCPU *cpu, SpaprMachineState *spapr, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { - ICSState *ics = spapr->ics; + ICSState *ics = ICS(spapr->ics); uint32_t nr, srcno, server, priority; CHECK_EMULATED_XICS_RTAS(spapr, rets); @@ -189,7 +190,7 @@ static void rtas_get_xive(PowerPCCPU *cpu, SpaprMachineState *spapr, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { - ICSState *ics = spapr->ics; + ICSState *ics = ICS(spapr->ics); uint32_t nr, srcno; CHECK_EMULATED_XICS_RTAS(spapr, rets); @@ -221,7 +222,7 @@ static void rtas_int_off(PowerPCCPU *cpu, SpaprMachineState *spapr, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { - ICSState *ics = spapr->ics; + ICSState *ics = ICS(spapr->ics); uint32_t nr, srcno; CHECK_EMULATED_XICS_RTAS(spapr, rets); @@ -254,7 +255,7 @@ static void rtas_int_on(PowerPCCPU *cpu, SpaprMachineState *spapr, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { - ICSState *ics = spapr->ics; + ICSState *ics = ICS(spapr->ics); uint32_t nr, srcno; CHECK_EMULATED_XICS_RTAS(spapr, rets); @@ -285,10 +286,13 @@ static void rtas_int_on(PowerPCCPU *cpu, SpaprMachineState *spapr, static void ics_spapr_realize(DeviceState *dev, Error **errp) { - ICSState *ics = ICS_SPAPR(dev); - ICSStateClass *icsc = ICS_GET_CLASS(ics); + IcsSpaprState *sics = ICS_SPAPR(dev); + ICSStateClass *icsc = ICS_GET_CLASS(dev); Error *local_err = NULL; + /* Set by spapr_irq_init() */ + g_assert(sics->nr_servers); + icsc->parent_realize(dev, &local_err); if (local_err) { error_propagate(errp, local_err); @@ -312,7 +316,7 @@ static void xics_spapr_dt(SpaprInterruptController *intc, uint32_t nr_servers, void *fdt, uint32_t phandle) { uint32_t interrupt_server_ranges_prop[] = { - 0, cpu_to_be32(nr_servers), + 0, cpu_to_be32(ICS_SPAPR(intc)->nr_servers), }; int node; @@ -333,7 +337,7 @@ static void xics_spapr_dt(SpaprInterruptController *intc, uint32_t nr_servers, static int xics_spapr_cpu_intc_create(SpaprInterruptController *intc, PowerPCCPU *cpu, Error **errp) { - ICSState *ics = ICS_SPAPR(intc); + ICSState *ics = ICS(intc); Object *obj; SpaprCpuState *spapr_cpu = spapr_cpu_state(cpu); @@ -364,7 +368,7 @@ static void xics_spapr_cpu_intc_destroy(SpaprInterruptController *intc, static int xics_spapr_claim_irq(SpaprInterruptController *intc, int irq, bool lsi, Error **errp) { - ICSState *ics = ICS_SPAPR(intc); + ICSState *ics = ICS(intc); assert(ics); assert(ics_valid_irq(ics, irq)); @@ -380,7 +384,7 @@ static int xics_spapr_claim_irq(SpaprInterruptController *intc, int irq, static void xics_spapr_free_irq(SpaprInterruptController *intc, int irq) { - ICSState *ics = ICS_SPAPR(intc); + ICSState *ics = ICS(intc); uint32_t srcno = irq - ics->offset; assert(ics_valid_irq(ics, irq)); @@ -390,7 +394,7 @@ static void xics_spapr_free_irq(SpaprInterruptController *intc, int irq) static void xics_spapr_set_irq(SpaprInterruptController *intc, int irq, int val) { - ICSState *ics = ICS_SPAPR(intc); + ICSState *ics = ICS(intc); uint32_t srcno = irq - ics->offset; ics_set_irq(ics, srcno, val); @@ -398,7 +402,7 @@ static void xics_spapr_set_irq(SpaprInterruptController *intc, int irq, int val) static void xics_spapr_print_info(SpaprInterruptController *intc, Monitor *mon) { - ICSState *ics = ICS_SPAPR(intc); + ICSState *ics = ICS(intc); CPUState *cs; CPU_FOREACH(cs) { @@ -426,7 +430,8 @@ static int xics_spapr_activate(SpaprInterruptController *intc, uint32_t nr_servers, Error **errp) { if (kvm_enabled()) { - return spapr_irq_init_kvm(xics_kvm_connect, intc, nr_servers, errp); + return spapr_irq_init_kvm(xics_kvm_connect, intc, + ICS_SPAPR(intc)->nr_servers, errp); } return 0; } @@ -438,6 +443,11 @@ static void xics_spapr_deactivate(SpaprInterruptController *intc) } } +static Property ics_spapr_properties[] = { + DEFINE_PROP_UINT32("nr-servers", IcsSpaprState, nr_servers, 0), + DEFINE_PROP_END_OF_LIST(), +}; + static void ics_spapr_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -446,6 +456,7 @@ static void ics_spapr_class_init(ObjectClass *klass, void *data) device_class_set_parent_realize(dc, ics_spapr_realize, &isc->parent_realize); + device_class_set_props(dc, ics_spapr_properties); sicc->activate = xics_spapr_activate; sicc->deactivate = xics_spapr_deactivate; sicc->cpu_intc_create = xics_spapr_cpu_intc_create; @@ -462,6 +473,7 @@ static void ics_spapr_class_init(ObjectClass *klass, void *data) static const TypeInfo ics_spapr_info = { .name = TYPE_ICS_SPAPR, .parent = TYPE_ICS, + .instance_size = sizeof(IcsSpaprState), .class_init = ics_spapr_class_init, .interfaces = (InterfaceInfo[]) { { TYPE_SPAPR_INTC }, diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 12a012d9dd09..21de0456446b 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4218,15 +4218,16 @@ static void spapr_phb_placement(SpaprMachineState *spapr, uint32_t index, static ICSState *spapr_ics_get(XICSFabric *dev, int irq) { SpaprMachineState *spapr = SPAPR_MACHINE(dev); + ICSState *ics = ICS(spapr->ics); - return ics_valid_irq(spapr->ics, irq) ? spapr->ics : NULL; + return ics_valid_irq(ics, irq) ? ics : NULL; } static void spapr_ics_resend(XICSFabric *dev) { SpaprMachineState *spapr = SPAPR_MACHINE(dev); - ics_resend(spapr->ics); + ics_resend(ICS(spapr->ics)); } static ICPState *spapr_icp_get(XICSFabric *xi, int vcpu_id) diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 2dacbecfd5fd..be6f4041e433 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -316,6 +316,9 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **errp) object_property_set_link(obj, ICS_PROP_XICS, OBJECT(spapr), &error_abort); object_property_set_int(obj, "nr-irqs", smc->nr_xirqs, &error_abort); + object_property_set_uint(obj, "nr-servers", + spapr_max_server_number(spapr), + &error_abort); if (!qdev_realize(DEVICE(obj), NULL, errp)) { return; } @@ -426,7 +429,7 @@ qemu_irq spapr_qirq(SpaprMachineState *spapr, int irq) assert(irq < (smc->nr_xirqs + SPAPR_XIRQ_BASE)); if (spapr->ics) { - assert(ics_valid_irq(spapr->ics, irq)); + assert(ics_valid_irq(ICS(spapr->ics), irq)); } if (spapr->xive) { assert(irq < spapr->xive->nr_irqs); @@ -556,7 +559,7 @@ static int ics_find_free_block(ICSState *ics, int num, int alignnum) int spapr_irq_find(SpaprMachineState *spapr, int num, bool align, Error **errp) { - ICSState *ics = spapr->ics; + ICSState *ics = ICS(spapr->ics); int first = -1; assert(ics); From patchwork Fri Nov 20 17:46:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 11921467 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48080C2D0E4 for ; Fri, 20 Nov 2020 17:57:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 96EA12240B for ; Fri, 20 Nov 2020 17:57:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 96EA12240B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kaod.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:60526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kgAem-00030p-Fi for qemu-devel@archiver.kernel.org; Fri, 20 Nov 2020 12:57:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgAV7-0008UY-0m for qemu-devel@nongnu.org; Fri, 20 Nov 2020 12:47:14 -0500 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:43338) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kgAV2-00059G-JN for qemu-devel@nongnu.org; Fri, 20 Nov 2020 12:47:12 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-510-XutxK6N-Oo2VrwJAmco-EA-1; Fri, 20 Nov 2020 12:47:00 -0500 X-MC-Unique: XutxK6N-Oo2VrwJAmco-EA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 30BCB80ED8A; Fri, 20 Nov 2020 17:46:59 +0000 (UTC) Received: from bahia.redhat.com (ovpn-112-44.ams2.redhat.com [10.36.112.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A6935C1D5; Fri, 20 Nov 2020 17:46:57 +0000 (UTC) From: Greg Kurz To: qemu-devel@nongnu.org Subject: [PATCH for-6.0 7/8] spapr: Drop "nr_servers" argument of the sPAPR IC activate() operation Date: Fri, 20 Nov 2020 18:46:45 +0100 Message-Id: <20201120174646.619395-8-groug@kaod.org> In-Reply-To: <20201120174646.619395-1-groug@kaod.org> References: <20201120174646.619395-1-groug@kaod.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kaod.org Received-SPF: softfail client-ip=205.139.111.44; envelope-from=groug@kaod.org; helo=us-smtp-delivery-44.mimecast.com X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no 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: Greg Kurz , qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric_L?= =?utf-8?q?e_Goater?= , David Gibson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This argument isn't used by the backends anymore. Signed-off-by: Greg Kurz --- include/hw/ppc/spapr_irq.h | 3 +-- hw/intc/spapr_xive.c | 3 +-- hw/intc/xics_spapr.c | 3 +-- hw/ppc/spapr_irq.c | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/hw/ppc/spapr_irq.h b/include/hw/ppc/spapr_irq.h index c22a72c9e270..3e1c619d4c06 100644 --- a/include/hw/ppc/spapr_irq.h +++ b/include/hw/ppc/spapr_irq.h @@ -43,8 +43,7 @@ DECLARE_CLASS_CHECKERS(SpaprInterruptControllerClass, SPAPR_INTC, struct SpaprInterruptControllerClass { InterfaceClass parent; - int (*activate)(SpaprInterruptController *intc, uint32_t nr_servers, - Error **errp); + int (*activate)(SpaprInterruptController *intc, Error **errp); void (*deactivate)(SpaprInterruptController *intc); /* diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index d13a2955ce9b..8331026fdb12 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -754,8 +754,7 @@ static void spapr_xive_dt(SpaprInterruptController *intc, uint32_t nr_servers, plat_res_int_priorities, sizeof(plat_res_int_priorities))); } -static int spapr_xive_activate(SpaprInterruptController *intc, - uint32_t nr_servers, Error **errp) +static int spapr_xive_activate(SpaprInterruptController *intc, Error **errp) { SpaprXive *xive = SPAPR_XIVE(intc); diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c index ce147e8980ed..8810bd93c856 100644 --- a/hw/intc/xics_spapr.c +++ b/hw/intc/xics_spapr.c @@ -426,8 +426,7 @@ static int xics_spapr_post_load(SpaprInterruptController *intc, int version_id) return 0; } -static int xics_spapr_activate(SpaprInterruptController *intc, - uint32_t nr_servers, Error **errp) +static int xics_spapr_activate(SpaprInterruptController *intc, Error **errp) { if (kvm_enabled()) { return spapr_irq_init_kvm(xics_kvm_connect, intc, diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index be6f4041e433..f2897fbc942a 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -480,7 +480,6 @@ static void set_active_intc(SpaprMachineState *spapr, SpaprInterruptController *new_intc) { SpaprInterruptControllerClass *sicc; - uint32_t nr_servers = spapr_max_server_number(spapr); assert(new_intc); @@ -498,7 +497,7 @@ static void set_active_intc(SpaprMachineState *spapr, sicc = SPAPR_INTC_GET_CLASS(new_intc); if (sicc->activate) { - sicc->activate(new_intc, nr_servers, &error_fatal); + sicc->activate(new_intc, &error_fatal); } spapr->active_intc = new_intc; From patchwork Fri Nov 20 17:46:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 11921463 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51332C2D0E4 for ; Fri, 20 Nov 2020 17:55:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ABF6A2240B for ; Fri, 20 Nov 2020 17:55:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ABF6A2240B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kaod.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kgAdC-0001n7-Lj for qemu-devel@archiver.kernel.org; Fri, 20 Nov 2020 12:55:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgAV7-0008Ub-FI for qemu-devel@nongnu.org; Fri, 20 Nov 2020 12:47:14 -0500 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:28593) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kgAV4-0005A8-EH for qemu-devel@nongnu.org; Fri, 20 Nov 2020 12:47:13 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-334-D7kk5PBqMCKGEAOnqprtmw-1; Fri, 20 Nov 2020 12:47:03 -0500 X-MC-Unique: D7kk5PBqMCKGEAOnqprtmw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A74B680ED9D; Fri, 20 Nov 2020 17:47:00 +0000 (UTC) Received: from bahia.redhat.com (ovpn-112-44.ams2.redhat.com [10.36.112.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DE865C1D5; Fri, 20 Nov 2020 17:46:59 +0000 (UTC) From: Greg Kurz To: qemu-devel@nongnu.org Subject: [PATCH for-6.0 8/8] spapr: Drop "nr_servers" argument of the sPAPR IC dt() operation Date: Fri, 20 Nov 2020 18:46:46 +0100 Message-Id: <20201120174646.619395-9-groug@kaod.org> In-Reply-To: <20201120174646.619395-1-groug@kaod.org> References: <20201120174646.619395-1-groug@kaod.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=groug@kaod.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kaod.org Received-SPF: softfail client-ip=205.139.111.44; envelope-from=groug@kaod.org; helo=us-smtp-delivery-44.mimecast.com X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no 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: Greg Kurz , qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric_L?= =?utf-8?q?e_Goater?= , David Gibson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This argument isn't used by the backends anymore. Signed-off-by: Greg Kurz --- include/hw/ppc/spapr_irq.h | 6 ++---- hw/intc/spapr_xive.c | 4 ++-- hw/intc/xics_spapr.c | 4 ++-- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_irq.c | 5 ++--- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/include/hw/ppc/spapr_irq.h b/include/hw/ppc/spapr_irq.h index 3e1c619d4c06..e2519e4bc596 100644 --- a/include/hw/ppc/spapr_irq.h +++ b/include/hw/ppc/spapr_irq.h @@ -61,8 +61,7 @@ struct SpaprInterruptControllerClass { /* These methods should only be called on the active intc */ void (*set_irq)(SpaprInterruptController *intc, int irq, int val); void (*print_info)(SpaprInterruptController *intc, Monitor *mon); - void (*dt)(SpaprInterruptController *intc, uint32_t nr_servers, - void *fdt, uint32_t phandle); + void (*dt)(SpaprInterruptController *intc, void *fdt, uint32_t phandle); int (*post_load)(SpaprInterruptController *intc, int version_id); }; @@ -73,8 +72,7 @@ int spapr_irq_cpu_intc_create(struct SpaprMachineState *spapr, void spapr_irq_cpu_intc_reset(struct SpaprMachineState *spapr, PowerPCCPU *cpu); void spapr_irq_cpu_intc_destroy(struct SpaprMachineState *spapr, PowerPCCPU *cpu); void spapr_irq_print_info(struct SpaprMachineState *spapr, Monitor *mon); -void spapr_irq_dt(struct SpaprMachineState *spapr, uint32_t nr_servers, - void *fdt, uint32_t phandle); +void spapr_irq_dt(struct SpaprMachineState *spapr, void *fdt, uint32_t phandle); uint32_t spapr_irq_nr_msis(struct SpaprMachineState *spapr); int spapr_irq_msi_alloc(struct SpaprMachineState *spapr, uint32_t num, bool align, diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index 8331026fdb12..749cff9bf2b9 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -691,8 +691,8 @@ static void spapr_xive_print_info(SpaprInterruptController *intc, Monitor *mon) spapr_xive_pic_print_info(xive, mon); } -static void spapr_xive_dt(SpaprInterruptController *intc, uint32_t nr_servers, - void *fdt, uint32_t phandle) +static void spapr_xive_dt(SpaprInterruptController *intc, void *fdt, + uint32_t phandle) { SpaprXive *xive = SPAPR_XIVE(intc); int node; diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c index 8810bd93c856..a790b59f1bbc 100644 --- a/hw/intc/xics_spapr.c +++ b/hw/intc/xics_spapr.c @@ -312,8 +312,8 @@ static void ics_spapr_realize(DeviceState *dev, Error **errp) spapr_register_hypercall(H_IPOLL, h_ipoll); } -static void xics_spapr_dt(SpaprInterruptController *intc, uint32_t nr_servers, - void *fdt, uint32_t phandle) +static void xics_spapr_dt(SpaprInterruptController *intc, void *fdt, + uint32_t phandle) { uint32_t interrupt_server_ranges_prop[] = { 0, cpu_to_be32(ICS_SPAPR(intc)->nr_servers), diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 21de0456446b..595dd1b81ce1 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1164,7 +1164,7 @@ void *spapr_build_fdt(SpaprMachineState *spapr, bool reset, size_t space) _FDT(fdt_setprop_cell(fdt, 0, "#size-cells", 2)); /* /interrupt controller */ - spapr_irq_dt(spapr, spapr_max_server_number(spapr), fdt, PHANDLE_INTC); + spapr_irq_dt(spapr, fdt, PHANDLE_INTC); ret = spapr_dt_memory(spapr, fdt); if (ret < 0) { diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index f2897fbc942a..f93476d00a59 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -271,13 +271,12 @@ void spapr_irq_print_info(SpaprMachineState *spapr, Monitor *mon) sicc->print_info(spapr->active_intc, mon); } -void spapr_irq_dt(SpaprMachineState *spapr, uint32_t nr_servers, - void *fdt, uint32_t phandle) +void spapr_irq_dt(SpaprMachineState *spapr, void *fdt, uint32_t phandle) { SpaprInterruptControllerClass *sicc = SPAPR_INTC_GET_CLASS(spapr->active_intc); - sicc->dt(spapr->active_intc, nr_servers, fdt, phandle); + sicc->dt(spapr->active_intc, fdt, phandle); } uint32_t spapr_irq_nr_msis(SpaprMachineState *spapr)