From patchwork Fri Jul 16 08:27:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Leonardo_Br=C3=A1s?= X-Patchwork-Id: 1506066 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@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=linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=qHUoBUu3; 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 4GR4H75Tcsz9sWd for ; Fri, 16 Jul 2021 18:32:19 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4GR4H74PPZz3cCP for ; Fri, 16 Jul 2021 18:32:19 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=qHUoBUu3; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::f36; helo=mail-qv1-xf36.google.com; envelope-from=leobras.c@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=qHUoBUu3; dkim-atps=neutral Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4GR4BY16xgz3bY8 for ; Fri, 16 Jul 2021 18:28:21 +1000 (AEST) Received: by mail-qv1-xf36.google.com with SMTP id c15so4210788qvw.6 for ; Fri, 16 Jul 2021 01:28:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9HStJt93myujXkiZQMq2zmTujx5HW2GAuqZwyAMsw7c=; b=qHUoBUu3Sw3Tk0EuHyvuzjq4f6BBXmGfLKzUbS3/NaKeCWnBP2KjAbYBBMeQimTgUD qOEIZiwIpl/Zo/dZcW3xFuYlgfYrbo/IHzhVWXivW9raaiga4RK0yfVTWqGxmb79cSIh I8QjImbiI1SfuOSu71s9E460qBnw0r3Fa1qMiMdQUYoSdaUtGqUV9DwIA4A7dV1fVvXC xPvUBWPRiRBZ6X3ykVrhAkwMRuzVl3jTb5P7BGPApI3zed0lyXFyLqJyXkULD2KHn354 X160sTIvkxmzScKCG46SU/uZtNpH/B1hNdkio/VNablnNDAw5cPTWWFjJeLtw16N9Vcm IIww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9HStJt93myujXkiZQMq2zmTujx5HW2GAuqZwyAMsw7c=; b=DaOXeXqiZt5qyCAYIo80JfWLP6wwmE0chFzioCqb0IhsRsKNDia5eqAymjf6PT4Kib 96t6l1Bgz1+FhE6TSOrlQ5MI17walCZ0adf3/S+kIuJeAW3nMcjuxTzBgvaywUoRRpHx qjXsxXQ7XSin+wNQ+PMrJWnIi1OiBeyX2bruEF/cXA7gzfYzThSiAwOZQ3NGehkdXyLJ EooNj/2622DtClgc4T0af51UFZj2vkyILduY1MkpeXFbdVt+h0DGN1nWi8sZKxmJTGUd FDVnUwbUFfywDt2w+xm2FzR5/8NWOVusFytCDr+VpNw5sE24AE95tP302VZmafrFrehA 21QA== X-Gm-Message-State: AOAM531o6HXzjtQ2HmWCJ/ffceqfqO/1wwyu4Bhag/xaXCgjd9jozRdG CPzRTtm3Y8FHthqYfhjJX14= X-Google-Smtp-Source: ABdhPJw0i5ZUI8lYnbnD00lebBmJteNllGdC0MOzJ03SzUov36MdHGpP20MCxVYVmLVjuJDILGBzsg== X-Received: by 2002:ad4:5144:: with SMTP id g4mr9049706qvq.3.1626424098644; Fri, 16 Jul 2021 01:28:18 -0700 (PDT) Received: from LeoBras.redhat.com ([2804:14c:482:92eb:ffdf:6b35:b94d:258]) by smtp.gmail.com with ESMTPSA id q199sm3603540qka.112.2021.07.16.01.28.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jul 2021 01:28:18 -0700 (PDT) From: Leonardo Bras To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Leonardo Bras , Alexey Kardashevskiy , David Gibson , kernel test robot , Nicolin Chen , Frederic Barrat Subject: [PATCH v5 09/11] powerpc/pseries/iommu: Find existing DDW with given property name Date: Fri, 16 Jul 2021 05:27:54 -0300 Message-Id: <20210716082755.428187-10-leobras.c@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210716082755.428187-1-leobras.c@gmail.com> References: <20210716082755.428187-1-leobras.c@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" At the moment pseries stores information about created directly mapped DDW window in DIRECT64_PROPNAME. With the objective of implementing indirect DMA mapping with DDW, it's necessary to have another propriety name to make sure kexec'ing into older kernels does not break, as it would if we reuse DIRECT64_PROPNAME. In order to have this, find_existing_ddw_windows() needs to be able to look for different property names. Extract find_existing_ddw_windows() into find_existing_ddw_windows_named() and calls it with current property name. Signed-off-by: Leonardo Bras Reviewed-by: Alexey Kardashevskiy Reviewed-by: Frederic Barrat --- arch/powerpc/platforms/pseries/iommu.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index 17c6f4706e76..22d251e15b61 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c @@ -895,24 +895,21 @@ static struct direct_window *ddw_list_new_entry(struct device_node *pdn, return window; } -static int find_existing_ddw_windows(void) +static void find_existing_ddw_windows_named(const char *name) { int len; struct device_node *pdn; struct direct_window *window; - const struct dynamic_dma_window_prop *direct64; - - if (!firmware_has_feature(FW_FEATURE_LPAR)) - return 0; + const struct dynamic_dma_window_prop *dma64; - 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, DIRECT64_PROPNAME); + for_each_node_with_property(pdn, name) { + dma64 = of_get_property(pdn, name, &len); + if (!dma64 || len < sizeof(*dma64)) { + remove_ddw(pdn, true, name); continue; } - window = ddw_list_new_entry(pdn, direct64); + window = ddw_list_new_entry(pdn, dma64); if (!window) break; @@ -920,6 +917,14 @@ static int find_existing_ddw_windows(void) list_add(&window->list, &direct_window_list); spin_unlock(&direct_window_list_lock); } +} + +static int find_existing_ddw_windows(void) +{ + if (!firmware_has_feature(FW_FEATURE_LPAR)) + return 0; + + find_existing_ddw_windows_named(DIRECT64_PROPNAME); return 0; }