From patchwork Wed Aug 4 07:21:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1513237 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=FMkFczKJ; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gfjv50k0Hz9sT6 for ; Wed, 4 Aug 2021 17:25:21 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Gfjv501LMz3dW0 for ; Wed, 4 Aug 2021 17:25:21 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=FMkFczKJ; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=FMkFczKJ; dkim-atps=neutral Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Gfjrl5m1Lz3bWr for ; Wed, 4 Aug 2021 17:23:19 +1000 (AEST) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17473drE073942; Wed, 4 Aug 2021 03:23:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pp1; bh=dt7QfGbUyryFsTZBKkdyvBJ70l7L4phiWP/5nlJAVdg=; b=FMkFczKJSKMWL6JQbUc+eUmkmgfZ4kY+LbZ3bBKHMKJ/DJxnrxbYO5H9uKtFTi1a8jxP 3uZXR106lOmm0tvGLQ+xdthGUajugB8FAzTQ++zJ2pAfKUHRE5mo6Hlfo39XjGHHhoBQ f4gei/VqZjEkOH6SWP2r/trGmmbujDDF6vFRlgRQ7lPtjFNSDkC0vulaolOxOEWuWoa2 3ym8/LNWluLO5tNJHqhZ/a96XTAhrA6nU5X69MYaZonM3Qamyq9H9BCDGCbVmmYWZ3o9 GgFlbwgqn4inTMY82+sXMZCo/wO5R8NWGQy74lhUpz4dTgESojfl0OlgMk8QHFOY4mZd 7w== Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 3a733jqbr5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Aug 2021 03:23:09 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1746mWv0022014; Wed, 4 Aug 2021 07:23:07 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma02fra.de.ibm.com with ESMTP id 3a4x58quty-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Aug 2021 07:23:07 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1747K9JK13238536 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Aug 2021 07:20:09 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9E6A2AE05F; Wed, 4 Aug 2021 07:23:04 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 242F5AE045; Wed, 4 Aug 2021 07:23:03 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.83.73]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 4 Aug 2021 07:23:02 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 4 Aug 2021 12:51:14 +0530 Message-Id: <20210804072137.1147875-37-hegdevasant@linux.vnet.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210804072137.1147875-1-hegdevasant@linux.vnet.ibm.com> References: <20210804072137.1147875-1-hegdevasant@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: r_zuURzM72AGXJmAnB3s7NnhInVDRnkT X-Proofpoint-GUID: r_zuURzM72AGXJmAnB3s7NnhInVDRnkT X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-08-04_02:2021-08-03, 2021-08-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 spamscore=0 priorityscore=1501 phishscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 suspectscore=0 lowpriorityscore=0 mlxscore=0 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108040036 Subject: [Skiboot] [PATCH v2 36/59] hw/phb5: Add support for 'Address-Based Interrupt Trigger' mode X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?C=C3=A9dric_Le_Goater?= Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" From: Cédric Le Goater The PHB5 introduces a new Address-Based Interrupt mode which extends the notification offloading to the ESB pages. When ABT is activated, the PHB maps the interrupt source number into the interrupt command address. The PHB triggers the interrupt using directly the IC ESB page of the interrupt number and does not use the notify page of the IC anymore. The PHB interrrupt configuration under ABT is a little different. The 'Interrupt Notify Base Address' register points to the base address of the IC ESB pages and not to the notify page of the IC anymore as on P9. The 'Interrupt Notify Base Index' register is unused. This should improve overall performance. The P10 IC can handle higher interrupt rates compared to P9 and the PHB latency should be improved under ABT. Debug is easier as the interrupt number is now exposed on the PowerBUS. Signed-off-by: Cédric Le Goater [FB: port to phb4.c] Signed-off-by: Frederic Barrat Signed-off-by: Cédric Le Goater Signed-off-by: Vasant Hegde --- hw/phb4.c | 63 ++++++++++++++++++++++++++++++++++++++++----- hw/xive2.c | 6 ----- include/phb4-regs.h | 2 ++ 3 files changed, 59 insertions(+), 12 deletions(-) diff --git a/hw/phb4.c b/hw/phb4.c index d2d9f9ec0..d2fc274b3 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -159,6 +159,18 @@ static inline bool phb_pq_disable(struct phb4 *p __unused) return false; } +/* + * Use the ESB page of the XIVE IC for event notification. Latency + * improvement. + */ +static inline bool phb_abt_mode(struct phb4 *p __unused) +{ + if (is_phb5()) + return 1; + + return false; +} + static inline bool phb_can_store_eoi(struct phb4 *p) { if (is_phb5()) @@ -5000,12 +5012,49 @@ static const struct phb_ops phb4_ops = { static void phb4_init_ioda3(struct phb4 *p) { - /* Init_18 - Interrupt Notify Base Address */ - out_be64(p->regs + PHB_INT_NOTIFY_ADDR, p->irq_port); + if (is_phb5()) { + /* + * When ABT is on, the MSIs on the PHB use the PQ state bits + * of the IC and MSI triggers from the PHB are forwarded + * directly to the IC ESB page. However, the LSIs are still + * controlled locally on the PHB and LSI triggers use a + * special offset for trigger injection. + */ + if (phb_abt_mode(p)) { + uint64_t mmio_base = xive2_get_esb_base(p->base_msi); + + PHBDBG(p, "Using ABT mode. ESB: 0x%016llx\n", mmio_base); + + /* Init_18 - Interrupt Notify Base Address */ + out_be64(p->regs + PHB_INT_NOTIFY_ADDR, + PHB_INT_NOTIFY_ADDR_64K | mmio_base); + + /* Interrupt Notify Base Index is unused */ + } else { + p->irq_port = xive2_get_notify_port(p->chip_id, + XIVE_HW_SRC_PHBn(p->index)); + + PHBDBG(p, "Using IC notif page at 0x%016llx\n", + p->irq_port); - /* Init_19 - Interrupt Notify Base Index */ - out_be64(p->regs + PHB_INT_NOTIFY_INDEX, - xive2_get_notify_base(p->base_msi)); + /* Init_18 - Interrupt Notify Base Address */ + out_be64(p->regs + PHB_INT_NOTIFY_ADDR, p->irq_port); + + /* Init_19 - Interrupt Notify Base Index */ + out_be64(p->regs + PHB_INT_NOTIFY_INDEX, + xive2_get_notify_base(p->base_msi)); + } + + } else { /* p9 */ + p->irq_port = xive_get_notify_port(p->chip_id, + XIVE_HW_SRC_PHBn(p->index)); + /* Init_18 - Interrupt Notify Base Address */ + out_be64(p->regs + PHB_INT_NOTIFY_ADDR, p->irq_port); + + /* Init_19 - Interrupt Notify Base Index */ + out_be64(p->regs + PHB_INT_NOTIFY_INDEX, + xive_get_notify_base(p->base_msi)); + } /* Init_19x - Not in spec: Initialize source ID */ PHBDBG(p, "Reset state SRC_ID: %016llx\n", @@ -5384,6 +5433,8 @@ static void phb4_init_hw(struct phb4 *p) val |= SETFIELD(PHB_CTRLR_TVT_ADDR_SEL, 0ull, TVT_2_PER_PE); if (phb_pq_disable(p)) val |= PHB_CTRLR_IRQ_PQ_DISABLE; + if (phb_abt_mode(p)) + val |= PHB_CTRLR_IRQ_ABT_MODE; if (phb_can_store_eoi(p)) { val |= PHB_CTRLR_IRQ_STORE_EOI; PHBDBG(p, "store EOI is enabled\n"); @@ -5958,7 +6009,7 @@ static void phb4_create(struct dt_node *np) * ESB pages of the XIVE IC for the MSI sources instead of the * ESB pages of the PHB. */ - if (phb_pq_disable(p)) { + if (phb_pq_disable(p) || phb_abt_mode(p)) { xive2_register_esb_source(p->base_msi, p->num_irqs - 8); } else { xive2_register_hw_source(p->base_msi, diff --git a/hw/xive2.c b/hw/xive2.c index 3f4958fce..cba050fa1 100644 --- a/hw/xive2.c +++ b/hw/xive2.c @@ -2141,12 +2141,6 @@ uint64_t xive2_get_notify_port(uint32_t chip_id, uint32_t ent) * * P10 might now be randomizing the cache line bits in HW to * balance snoop bus usage - * - * TODO (phb5) : implement "address based triggers" (DD2.0?) - * - * The PHBs would no longer target the notify port page but - * the "base ESB MMIO address" of the ESB/EAS range they are - * allocated. Needs a XIVE API change for the PHBs. */ switch(ent) { case XIVE_HW_SRC_PHBn(0): diff --git a/include/phb4-regs.h b/include/phb4-regs.h index 139522814..99633e103 100644 --- a/include/phb4-regs.h +++ b/include/phb4-regs.h @@ -97,11 +97,13 @@ #define PHB_PAPR_ERR_INJ_MASK_MMIO PPC_BITMASK(16,63) #define PHB_ETU_ERR_SUMMARY 0x2c8 #define PHB_INT_NOTIFY_ADDR 0x300 +#define PHB_INT_NOTIFY_ADDR_64K PPC_BIT(1) /* PHB5 */ #define PHB_INT_NOTIFY_INDEX 0x308 #define PHB_VERSION 0x800 #define PHB_CTRLR 0x810 #define PHB_CTRLR_IRQ_PQ_DISABLE PPC_BIT(9) /* PHB5 */ +#define PHB_CTRLR_IRQ_ABT_MODE PPC_BIT(10) /* PHB5 */ #define PHB_CTRLR_IRQ_PGSZ_64K PPC_BIT(11) #define PHB_CTRLR_IRQ_STORE_EOI PPC_BIT(12) #define PHB_CTRLR_MMIO_RD_STRICT PPC_BIT(13)