From patchwork Thu Oct 14 15:57:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe Lombard X-Patchwork-Id: 1540994 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=Ci0v2TJN; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HVYwZ0xfLz9sNH for ; Fri, 15 Oct 2021 02:58:38 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HVYwZ08DDz3086 for ; Fri, 15 Oct 2021 02:58:38 +1100 (AEDT) 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=Ci0v2TJN; 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=clombard@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=Ci0v2TJN; 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 4HVYtz60sFz2ypn for ; Fri, 15 Oct 2021 02:57:15 +1100 (AEDT) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19EFUdSu002371 for ; Thu, 14 Oct 2021 11:57:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pp1; bh=dQ/621VFUFV4Wy7MEN7RHN9igVINRimaVgVA9ni6v00=; b=Ci0v2TJNZh7ZlPVMPgLXGx3QeBZFpcfAVAh50+Vl0vE/KgOYqayDpWTBtveKykBys8Bi 1dBKni2uibiXFpIX3vS2cYTxewIjMPwUMvOyXM0QQlveti2XIzevP6wHlv9q158vhXJx QDE3UXRRuYjFXudPCjkZ0aTJ28EJXJ9Z4EVVAuWjCgWrcE3z4rD78Xz28XzHKyveRnHT YxIcK4iQgo+2xo/9IYF/mylZa1lZrf4tPav+D7+ViNKFVjUu8kvq6UUJMB0ZnrLWEPR2 lCuVDf8b/UCMW026JhWVS/9zNTmNcvXd4EolZGfX63MPyOsNcV0zBEUveVXj/EzU/Mld 1A== Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bpq8kgjty-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 14 Oct 2021 11:57:13 -0400 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 19EFXiYk000390 for ; Thu, 14 Oct 2021 15:57:10 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma06fra.de.ibm.com with ESMTP id 3bk2bk444w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 14 Oct 2021 15:57:10 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19EFv8t56619806 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 14 Oct 2021 15:57:08 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0005E11C04C for ; Thu, 14 Oct 2021 15:57:07 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DDFD311C04A for ; Thu, 14 Oct 2021 15:57:07 +0000 (GMT) Received: from li-ed209401-43e8-11cb-8043-c0c0b85d70f7.biot.fr.ibm.com (unknown [9.144.57.15]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 14 Oct 2021 15:57:07 +0000 (GMT) From: Christophe Lombard To: skiboot@lists.ozlabs.org Date: Thu, 14 Oct 2021 17:57:03 +0200 Message-Id: <20211014155704.46441-15-clombard@linux.vnet.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211014155704.46441-1-clombard@linux.vnet.ibm.com> References: <20211014155704.46441-1-clombard@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: X2Gojf95dLIYYbUg8zpLRRJGB1mvIz6k X-Proofpoint-ORIG-GUID: X2Gojf95dLIYYbUg8zpLRRJGB1mvIz6k X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-14_09,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 phishscore=0 clxscore=1015 adultscore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=999 suspectscore=0 mlxscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110140093 Subject: [Skiboot] [PATCH V3 14/15] pau: mmio invalidates 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: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The remaining translation mode: OpenCAPI 5.0 with TLBI/SLBI Snooping, is not used due to performance problems caused by the mismatch between the ERAT and Bloom Filter sizes. When the Address Translation Mode requires TLB and SLB Invalidate operations to be initiated using MMIO registers, a set of registers like the following is used: • XTS MMIO ATSD0 LPARID register • XTS MMIO ATSD0 AVA register • XTS MMIO ATSD0 launch register, write access initiates a shoot down • XTS MMIO ATSD0 status register Signed-off-by: Christophe Lombard Reviewed-by: Frederic Barrat --- hw/npu-opal.c | 3 +++ hw/pau.c | 36 ++++++++++++++++++++++++++++++++++++ include/pau-regs.h | 8 ++++++++ include/pau.h | 2 ++ 4 files changed, 49 insertions(+) diff --git a/hw/npu-opal.c b/hw/npu-opal.c index cf136901..2e455dc9 100644 --- a/hw/npu-opal.c +++ b/hw/npu-opal.c @@ -52,6 +52,9 @@ static int64_t opal_npu_map_lpar(uint64_t phb_id, uint64_t bdf, uint64_t lparid, if (phb->phb_type == phb_type_npu_v2) return npu2_map_lpar(phb, bdf, lparid, lpcr); + if (phb->phb_type == phb_type_pau_opencapi) + return pau_opencapi_map_atsd_lpar(phb, bdf, lparid, lpcr); + return OPAL_PARAMETER; } opal_call(OPAL_NPU_MAP_LPAR, opal_npu_map_lpar, 4); diff --git a/hw/pau.c b/hw/pau.c index 83cd6fe9..9f6a7092 100644 --- a/hw/pau.c +++ b/hw/pau.c @@ -268,6 +268,29 @@ static void pau_device_detect_fixup(struct pau_dev *dev) dt_add_property_strings(dn, "ibm,pau-link-type", "unknown"); } +int64_t pau_opencapi_map_atsd_lpar(struct phb *phb, uint64_t __unused bdf, + uint64_t lparid, uint64_t __unused lpcr) +{ + struct pau_dev *dev = pau_phb_to_opencapi_dev(phb); + struct pau *pau = dev->pau; + uint64_t val; + + if (lparid >= PAU_XTS_ATSD_MAX) + return OPAL_PARAMETER; + + lock(&pau->lock); + + /* We need to allocate an ATSD per link */ + val = SETFIELD(PAU_XTS_ATSD_HYP_LPARID, 0ull, lparid); + if (!lparid) + val |= PAU_XTS_ATSD_HYP_MSR_HV; + + pau_write(pau, PAU_XTS_ATSD_HYP(lparid), val); + + unlock(&pau->lock); + return OPAL_SUCCESS; +} + int64_t pau_opencapi_spa_setup(struct phb *phb, uint32_t __unused bdfn, uint64_t addr, uint64_t PE_mask) { @@ -1442,6 +1465,18 @@ static void pau_opencapi_create_phb(struct pau_dev *dev) pau_opencapi_create_phb_slot(dev); } +static void pau_dt_add_mmio_atsd(struct pau_dev *dev) +{ + struct dt_node *dn = dev->phb.dt_node; + struct pau *pau = dev->pau; + uint64_t mmio_atsd[PAU_XTS_ATSD_MAX]; + + for (uint32_t i = 0; i < PAU_XTS_ATSD_MAX; i++) + mmio_atsd[i] = pau->regs[0] + PAU_XTS_ATSD_LAUNCH(i); + + dt_add_property(dn, "ibm,mmio-atsd", mmio_atsd, sizeof(mmio_atsd)); +} + static void pau_opencapi_dt_add_mmio_window(struct pau_dev *dev) { struct dt_node *dn = dev->phb.dt_node; @@ -1508,6 +1543,7 @@ static void pau_opencapi_dt_add_props(struct pau_dev *dev) dt_add_property_cells(dn, "ibm,opal-num-pes", PAU_MAX_PE_NUM); dt_add_property_cells(dn, "ibm,opal-reserved-pe", PAU_RESERVED_PE_NUM); + pau_dt_add_mmio_atsd(dev); pau_opencapi_dt_add_mmio_window(dev); pau_opencapi_dt_add_hotpluggable(dev); } diff --git a/include/pau-regs.h b/include/pau-regs.h index 57c2d723..da83ad44 100644 --- a/include/pau-regs.h +++ b/include/pau-regs.h @@ -37,6 +37,7 @@ #define PAU_BLOCK_XSL PAU_BLOCK(4, 0xE) #define PAU_BLOCK_PAU_XTS PAU_BLOCK(7, 1) #define PAU_BLOCK_PAU_MISC PAU_BLOCK(7, 2) +#define PAU_BLOCK_PAU_XTS_ATSD(n) PAU_BLOCK(8, (n)) /* * CQ_SM block registers @@ -176,6 +177,9 @@ #define PAU_XTS_CFG2_XSL2_ENA PPC_BIT(55) #define PAU_XTS_CFG3 (PAU_BLOCK_PAU_XTS + 0x068) #define PAU_XTS_CFG3_MMIOSD_OCAPI PPC_BIT(5) +#define PAU_XTS_ATSD_HYP(n) (PAU_BLOCK_PAU_XTS + 0x100 + (n) * 8) +#define PAU_XTS_ATSD_HYP_MSR_HV PPC_BIT(51) +#define PAU_XTS_ATSD_HYP_LPARID PPC_BITMASK(52, 63) /* MISC block registers */ #define PAU_MISC_OPTICAL_IO_CONFIG (PAU_BLOCK_PAU_MISC + 0x018) @@ -204,4 +208,8 @@ #define PAU_MISC_INT_2_CONFIG_XFAULT_2_5(n) PPC_BIT(0 + (n)) #define PAU_MISC_INT_2_CONFIG_XFAULT_0_1(n) PPC_BIT(54 + (n)) +/* PAU_XTS_ATSD block registers */ +#define PAU_XTS_ATSD_LAUNCH(n) (PAU_BLOCK_PAU_XTS_ATSD(n) + 0x000) +#define PAU_XTS_ATSD_MAX 16 + #endif /* __PAU_REGS_H */ diff --git a/include/pau.h b/include/pau.h index 894007d0..a70058f2 100644 --- a/include/pau.h +++ b/include/pau.h @@ -200,6 +200,8 @@ static inline uint64_t pau_read(struct pau *pau, uint64_t reg) } void pau_opencapi_dump_scoms(struct pau *pau); +int64_t pau_opencapi_map_atsd_lpar(struct phb *phb, uint64_t __unused bdf, + uint64_t lparid, uint64_t __unused lpcr); int64_t pau_opencapi_spa_setup(struct phb *phb, uint32_t __unused bdfn, uint64_t addr, uint64_t PE_mask); int64_t pau_opencapi_spa_clear_cache(struct phb *phb,