Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp334193rwb; Sun, 25 Sep 2022 22:08:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zKuP8Y9t+akmOn87nWjz1DdRR2BrVURR3MTmOkrxqR6qdGS9k3wok/MvVGwXHXjFW8SEX X-Received: by 2002:a17:90b:38ca:b0:203:64d2:dac5 with SMTP id nn10-20020a17090b38ca00b0020364d2dac5mr23018626pjb.209.1664168930323; Sun, 25 Sep 2022 22:08:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664168930; cv=none; d=google.com; s=arc-20160816; b=F2O9sduVKLZn+lQ5qtALu8GbysxxXEs47GQtrfBKrxQzujPuk2sCJzvhg6Y9zEZzVG bt0LWX8HDZTfnDV3Wdtb9SW5uv0XwryYMnU3GvEHMPGFg6vNXTxYnjg/5Wt+jvFL/BoX 2QeKPtvxaahCDe9yIcCjAfK6gWrQQnjoD3hBg2vMrNrAQyGiGEg2fwq0zmJxVNfIB+F1 aJT4Gfim2YMbbU+d6c5oeZNGCn65WIpujd6di5ouqZNSU+s7yyHw/kbjjEi3l02p6Ddi 3T29Di9b2ixlxm5Uk3sEb5AYQvO/gLNF4OHSrhBZYbkGyrUoxTplfSoqsA69Y5eWUlLf cnMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=jGIsZwaNfBcfeiotnezyR7XItoRe/odxVPptgwyxJio=; b=klgHxmw/3PdWl8n/Mg0W5H3Wdm1yYQoyM/6K+7lPe3rNH9syY7b53RWPumGTYdb4zK 7g0XAR4HKhuwsO+IG3pqHvzcg1AGt9A6G2yztHtHJdoBljxipJ8bkQJY4h+4KgrIFr+T u2+S494Vl0/S12N2Ry3pLsKNl+oHswjw/Q9/RSFshDa6C73vWH/DFnvlbXyorkoO8TUu KR0fWxv8/xvANf2WDjUO9mL09xLtfymLtyRLUWcTodk0yBiGhnI4y0+mJsXeLN9d0DFy 5wCnCWe3WRLNThK87sT0EjHrzz4p/+rXJQeq6kbjl2Fr0F/yaY7zKFPzkQSz/1XuGyhW vRBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=pbQXB42O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o3-20020a17090a3d4300b001fdd99854d3si10939367pjf.170.2022.09.25.22.08.37; Sun, 25 Sep 2022 22:08:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=pbQXB42O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232569AbiIZETa (ORCPT + 99 others); Mon, 26 Sep 2022 00:19:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229824AbiIZET2 (ORCPT ); Mon, 26 Sep 2022 00:19:28 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0905826ACE; Sun, 25 Sep 2022 21:19:26 -0700 (PDT) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28Q4FxYn022942; Mon, 26 Sep 2022 04:19:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=jGIsZwaNfBcfeiotnezyR7XItoRe/odxVPptgwyxJio=; b=pbQXB42OoCBCCKzpuUeBVbguNcTuY4ceGb7Gf/P/luAU2VGA4kAD7HLxBkfBCWvry7xw l/SUqZM4GMi9YAlehh16WIcg/XeAYhvfyysExt6Htf7kqelmS/LPMmKmJfRvU2ulQI2f +zAYbXkWvbjncadZ7cCwXpt2rJH9pQOeqNd0I0zh72z+rn3DzjeHx5GKfmYyuoFaKjaE b+ey4nJrEuyCoT0NuIccJ7NK8jvuUFKU61yhRo6dJiz+et7beURf/gNrFmZD+ImQMSnC 7J/HE+ZcPnvAK2icvVU5TZkaSzXQ0guUmoei3z0WgEOSaawD9PMRFFp8Ifawf9wPiKvs 3w== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3jss7sak2q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Sep 2022 04:19:08 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 28Q4E7no006922 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Sep 2022 04:14:07 GMT Received: from [10.216.15.146] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Sun, 25 Sep 2022 21:14:00 -0700 Message-ID: Date: Mon, 26 Sep 2022 09:43:44 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v7] PCI/ASPM: Update LTR threshold based upon reported max latencies Content-Language: en-US To: CC: , , , , , , , , , , , , Prasad Malisetty , Bjorn Helgaas , "Saheed O. Bolarinwa" , Vidya Sagar , =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= , Kai-Heng Feng References: <1663315719-21563-1-git-send-email-quic_krichai@quicinc.com> From: Krishna Chaitanya Chundru In-Reply-To: <1663315719-21563-1-git-send-email-quic_krichai@quicinc.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: o9wLo7hOrfou5W7E40euN1RuWHp-BkwM X-Proofpoint-GUID: o9wLo7hOrfou5W7E40euN1RuWHp-BkwM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-26_02,2022-09-22_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 impostorscore=0 clxscore=1015 mlxscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209260027 X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/16/2022 1:38 PM, Krishna chaitanya chundru wrote: > In ASPM driver, LTR threshold scale and value are updated based on > tcommon_mode and t_poweron values. In Kioxia NVMe L1.2 is failing due to > LTR threshold scale and value are greater values than max snoop/non-snoop > value. > > Based on PCIe r4.1, sec 5.5.1, L1.2 substate must be entered when > reported snoop/no-snoop values is greater than or equal to > LTR_L1.2_THRESHOLD value. > > Signed-off-by: Prasad Malisetty > Signed-off-by: Krishna chaitanya chundru > Acked-by: Manivannan Sadhasivam Ping for updates. There are no outstanding comments for this patch and also it is not being picked up in upstream. > --- > > I am taking this patch forward as prasad is no more working with our org. > changes since v6: > - Rebasing with pci/next. > changes since v5: > - no changes, just reposting as standalone patch instead of reply to > previous patch. > Changes since v4: > - Replaced conditional statements with min and max. > changes since v3: > - Changed the logic to include this condition "snoop/nosnoop > latencies are not equal to zero and lower than LTR_L1.2_THRESHOLD" > Changes since v2: > - Replaced LTRME logic with max snoop/no-snoop latencies check. > Changes since v1: > - Added missing variable declaration in v1 patch > --- > drivers/pci/pcie/aspm.c | 30 ++++++++++++++++++++++++++++++ > 1 file changed, 30 insertions(+) > > diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c > index 928bf64..2bb8470 100644 > --- a/drivers/pci/pcie/aspm.c > +++ b/drivers/pci/pcie/aspm.c > @@ -486,13 +486,35 @@ static void aspm_calc_l1ss_info(struct pcie_link_state *link, > { > struct pci_dev *child = link->downstream, *parent = link->pdev; > u32 val1, val2, scale1, scale2; > + u32 max_val, max_scale, max_snp_scale, max_snp_val, max_nsnp_scale, max_nsnp_val; > u32 t_common_mode, t_power_on, l1_2_threshold, scale, value; > u32 ctl1 = 0, ctl2 = 0; > u32 pctl1, pctl2, cctl1, cctl2; > + u16 ltr; > + u16 max_snoop_lat, max_nosnoop_lat; > > if (!(link->aspm_support & ASPM_STATE_L1_2_MASK)) > return; > > + ltr = pci_find_ext_capability(child, PCI_EXT_CAP_ID_LTR); > + if (!ltr) > + return; > + > + pci_read_config_word(child, ltr + PCI_LTR_MAX_SNOOP_LAT, &max_snoop_lat); > + pci_read_config_word(child, ltr + PCI_LTR_MAX_NOSNOOP_LAT, &max_nosnoop_lat); > + > + max_snp_scale = (max_snoop_lat & PCI_LTR_SCALE_MASK) >> PCI_LTR_SCALE_SHIFT; > + max_snp_val = max_snoop_lat & PCI_LTR_VALUE_MASK; > + > + max_nsnp_scale = (max_nosnoop_lat & PCI_LTR_SCALE_MASK) >> PCI_LTR_SCALE_SHIFT; > + max_nsnp_val = max_nosnoop_lat & PCI_LTR_VALUE_MASK; > + > + /* choose the greater max scale value between snoop and no snoop value*/ > + max_scale = max(max_snp_scale, max_nsnp_scale); > + > + /* choose the greater max value between snoop and no snoop scales */ > + max_val = max(max_snp_val, max_nsnp_val); > + > /* Choose the greater of the two Port Common_Mode_Restore_Times */ > val1 = (parent_l1ss_cap & PCI_L1SS_CAP_CM_RESTORE_TIME) >> 8; > val2 = (child_l1ss_cap & PCI_L1SS_CAP_CM_RESTORE_TIME) >> 8; > @@ -525,6 +547,14 @@ static void aspm_calc_l1ss_info(struct pcie_link_state *link, > */ > l1_2_threshold = 2 + 4 + t_common_mode + t_power_on; > encode_l12_threshold(l1_2_threshold, &scale, &value); > + > + /* > + * Based on PCIe r4.1, sec 5.5.1, L1.2 substate must be entered when reported > + * snoop/no-snoop values are greater than or equal to LTR_L1.2_THRESHOLD value. > + */ > + scale = min(scale, max_scale); > + value = min(value, max_val); > + > ctl1 |= t_common_mode << 8 | scale << 29 | value << 16; > > /* Some broken devices only support dword access to L1 SS */