From mboxrd@z Thu Jan 1 00:00:00 1970 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=-14.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLACK, USER_AGENT_SANE_1 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 2F02BC4320E for ; Fri, 27 Aug 2021 16:58:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0AA9960C40 for ; Fri, 27 Aug 2021 16:58:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230143AbhH0Q70 (ORCPT ); Fri, 27 Aug 2021 12:59:26 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:30582 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229667AbhH0Q7Y (ORCPT ); Fri, 27 Aug 2021 12:59:24 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17RGXnw9160813; Fri, 27 Aug 2021 12:58:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=G1bFtCzAbdq5KNIoJFyJHvQDP04QzWYfpuJi2xotdEY=; b=QkLX0juNXKVs2GaymTVoYEnmdMCvoUGqZ84bNTsofzop2LXTHLsSpytEAvdz9cobv/ED VXtTFkRyiK1sUgnQIQqJlzf7ZYTTjEx/0WI/sjALcUFDc58Y/+5/uwoimk3tWkvkay9x WmLv7V9wjYjLg5LwtAgLB9UMKaYSNvVhQqWWA52KJND4NgRyLaycur7UH9680rdKfahk lvddWOltFTcYrmiGVlgg/z+Ug4W+2kpCDEUQvuRJt0fff4eqE20cPAb3v4BLOn3cPdnZ F0ZiQV0OdwDi3lfsCZynq94Qdi00HJdvYuzJhjMXurELqtw/b4wLsRoEhEVOjlYflxOh QQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3aq0ysdy5k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Aug 2021 12:58:09 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 17RGYs99171307; Fri, 27 Aug 2021 12:58:09 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 3aq0ysdy4m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Aug 2021 12:58:09 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 17RGrgSc020316; Fri, 27 Aug 2021 16:58:07 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma06ams.nl.ibm.com with ESMTP id 3ajrrhkw05-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Aug 2021 16:58:07 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 17RGw4WF54395290 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 27 Aug 2021 16:58:05 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C41095205A; Fri, 27 Aug 2021 16:58:04 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.153.220]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6F1A95204F; Fri, 27 Aug 2021 16:58:04 +0000 (GMT) Subject: Re: [PATCH v6 08/11] powerpc/pseries/iommu: Update remove_dma_window() to accept property name To: Leonardo Bras , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Alexey Kardashevskiy , David Gibson , Nicolin Chen , kernel test robot Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20210817063929.38701-1-leobras.c@gmail.com> <20210817063929.38701-9-leobras.c@gmail.com> From: Frederic Barrat Message-ID: <50172860-7ceb-184e-6173-2cd728584d81@linux.ibm.com> Date: Fri, 27 Aug 2021 18:58:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210817063929.38701-9-leobras.c@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: nxMHvHR7oQfitpF_3Ct4eDD1p45CYc_W X-Proofpoint-ORIG-GUID: ujsb9XzkpUROXa6uMA-7fxo-6qRNkDNf X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-08-27_04:2021-08-26,2021-08-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 impostorscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 lowpriorityscore=0 suspectscore=0 clxscore=1015 adultscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108270098 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/08/2021 08:39, Leonardo Bras wrote: > Update remove_dma_window() so it can be used to remove DDW with a given > property name. > > This enables the creation of new property names for DDW, so we can > have different usage for it, like indirect mapping. > > Also, add return values to it so we can check if the property was found > while removing the active DDW. This allows skipping the remaining property > names while reducing the impact of multiple property names. > > Signed-off-by: Leonardo Bras > Reviewed-by: Alexey Kardashevskiy > --- Reviewed-by: Frederic Barrat > arch/powerpc/platforms/pseries/iommu.c | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > > diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c > index a47f59a8f107..901f290999d0 100644 > --- a/arch/powerpc/platforms/pseries/iommu.c > +++ b/arch/powerpc/platforms/pseries/iommu.c > @@ -844,31 +844,33 @@ static void remove_dma_window(struct device_node *np, u32 *ddw_avail, > __remove_dma_window(np, ddw_avail, liobn); > } > > -static void remove_ddw(struct device_node *np, bool remove_prop) > +static int remove_ddw(struct device_node *np, bool remove_prop, const char *win_name) > { > struct property *win; > u32 ddw_avail[DDW_APPLICABLE_SIZE]; > int ret = 0; > > + win = of_find_property(np, win_name, NULL); > + if (!win) > + return -EINVAL; > + > ret = of_property_read_u32_array(np, "ibm,ddw-applicable", > &ddw_avail[0], DDW_APPLICABLE_SIZE); > if (ret) > - return; > + return 0; > > - win = of_find_property(np, DIRECT64_PROPNAME, NULL); > - if (!win) > - return; > > if (win->length >= sizeof(struct dynamic_dma_window_prop)) > remove_dma_window(np, ddw_avail, win); > > if (!remove_prop) > - return; > + return 0; > > ret = of_remove_property(np, win); > if (ret) > pr_warn("%pOF: failed to remove direct window property: %d\n", > np, ret); > + return 0; > } > > static bool find_existing_ddw(struct device_node *pdn, u64 *dma_addr, int *window_shift) > @@ -921,7 +923,7 @@ static int find_existing_ddw_windows(void) > for_each_node_with_property(pdn, DIRECT64_PROPNAME) { > direct64 = of_get_property(pdn, DIRECT64_PROPNAME, &len); > if (!direct64 || len < sizeof(*direct64)) { > - remove_ddw(pdn, true); > + remove_ddw(pdn, true, DIRECT64_PROPNAME); > continue; > } > > @@ -1565,7 +1567,7 @@ static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long acti > * we have to remove the property when releasing > * the device node. > */ > - remove_ddw(np, false); > + remove_ddw(np, false, DIRECT64_PROPNAME); > if (pci && pci->table_group) > iommu_pseries_free_group(pci->table_group, > np->full_name); >