Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp954741pxb; Mon, 16 Aug 2021 23:42:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuf0TRZcIWmqCefv4vclQOnyHwZ0qVPfLER+EozbMdiRvwdMTKid9QGirqHqmM51o09lzC X-Received: by 2002:a05:6e02:1aa8:: with SMTP id l8mr1292927ilv.226.1629182531529; Mon, 16 Aug 2021 23:42:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629182531; cv=none; d=google.com; s=arc-20160816; b=KXJoXgRi16cn1/zMzpgAVDSG6lCKuHUpbMm0wPztBRJyGPvM4023XQxdky6dpndG/P juyfNZjwjZ2U3rLx7c58Rnx3l/Uyh7kDMTJNR9kgO5OjD27gMz48sljl0cvq+NSMMk/L g/0VpSneEZkAVVtSBVE+L1D00pgWBXR84gFMVRvMqbPd1QjG+B3Uttn4rl6YbJ4cIIY+ VAKrezXJE59MqTfq4WjbTnWDpX7k+kfv5Iv6Zun6m2AQ0K/NYIWFNYIRYc58eBcFjbKx /LlgCtKjuHl/0QO8Bpk12QAcX+YGe/SeFH2Avskr+uan0IOYiLTtjgh7gaIebYc+LKj7 65IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mLA7Zwi0SdMcNmft7yIFY9w3dhHjKJPMdMtlCDnEiwM=; b=vsgeIFaYN8f8BBnIB9QwLgs71b2kGu6vSsPgqqIQ81GZObx7yiM4dKlImOHzAZbaN9 UKKGIGiiowAX/gSFVX3KRHcjW+NFAOmCLwNQU7hEjq+L/VpaYdKgSu72/6+laBwvSWwP RBHHBTkefDil/8ApBcHBynKbRBrZi0dPv7xl3RUXiFQJP0Ri3jq3jKtyCUNYOcfnySSo ZQmNERLgX/3XbXHhXX+KHmFEVxjlHW+jRo3om9RSUcafkenqeMxsZrJfR1mO87RRX9dm TedSEPXVjFNGqLNdIF0E//WqDmwVzpduxVwZph8D0PHp1s8cwu1ZH+B8+hn2MCo93lyk tuEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PBCP9KJc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z9si1558799iow.13.2021.08.16.23.42.00; Mon, 16 Aug 2021 23:42:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PBCP9KJc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238647AbhHQGlU (ORCPT + 99 others); Tue, 17 Aug 2021 02:41:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238670AbhHQGlO (ORCPT ); Tue, 17 Aug 2021 02:41:14 -0400 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31D07C06129D for ; Mon, 16 Aug 2021 23:40:40 -0700 (PDT) Received: by mail-qt1-x82c.google.com with SMTP id z24so16315687qtn.8 for ; Mon, 16 Aug 2021 23:40:40 -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=mLA7Zwi0SdMcNmft7yIFY9w3dhHjKJPMdMtlCDnEiwM=; b=PBCP9KJcms41RLP2tQkcatWTwHaP9hLCv6kYtOwG4y44m6+5TqA8VUiANkGUqCpagA iAdSkxysz6oIGSmbb5nfIRzby+VXX5Qf1E+CuoM/6Z3l1X2WLdHznUtfdRvBdY9id9Ha P2ApKg9e396YeLnT1ckYvyK1w86oROkhtsTp9lybNsJRqUqXM8fTsgsBNy5O0G3jZj9x 2ZHBdbf8sKz06jfD65r+k7423Oiast0VPr5uVy17LLxc5jxcdp4M1klZ3AoA4o+SniQa dmFHQOM1+9LFFIGmpWJQWsE0S8blOZoSHgsyOhi3QnYSdKbngsz+IholLUU6CuOhPZj9 oLVw== 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=mLA7Zwi0SdMcNmft7yIFY9w3dhHjKJPMdMtlCDnEiwM=; b=Fx1f0niZK64JzXgHWYfc7kgbJl2y7ZVzSR2qcB7yUI08QfZYgI6j1CAVf8J7jgOwif xdBiYsPt/VWZHbmeawEu98wXeF3TcHx83HPVe5jOdL25xRgnmq0J6OZlSEt/XbZnOHPn ltqAXNvqXAHdlo2xKGIGEg26zsUp18qLq8uoKz63Bl3t3d7SCw0j+jd11luYT9hbIl+M BkpsAlDgKbO4ktwEReVLCmYTkYGJOcVG/rNhUnq4BblWdY7EHKaUZsGzCUklPT9I/tL2 iDH0oZ5mjB1v4+L+VXg1PvIAARJOW1V88ub47IrdCy7A26wVxImxHM2YJg5nM2UAcDXo ibaw== X-Gm-Message-State: AOAM5329Yt9QfAVV3sq/OJBdxQMUX/iEbGuyT34T8NpB2l0oP+NYN4fP NtQwtPw1mQK+KFe8Pqomlmw= X-Received: by 2002:ac8:4f14:: with SMTP id b20mr1696524qte.236.1629182439455; Mon, 16 Aug 2021 23:40:39 -0700 (PDT) Received: from LeoBras.redhat.com ([2804:431:c7f0:30b2:5c9e:50:88f3:269a]) by smtp.gmail.com with ESMTPSA id c11sm526938qth.29.2021.08.16.23.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Aug 2021 23:40:39 -0700 (PDT) From: Leonardo Bras To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Leonardo Bras , Alexey Kardashevskiy , Frederic Barrat , David Gibson , Nicolin Chen , kernel test robot Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 09/11] powerpc/pseries/iommu: Find existing DDW with given property name Date: Tue, 17 Aug 2021 03:39:27 -0300 Message-Id: <20210817063929.38701-10-leobras.c@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210817063929.38701-1-leobras.c@gmail.com> References: <20210817063929.38701-1-leobras.c@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 901f290999d0..e11c00b2dc1e 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c @@ -910,24 +910,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; @@ -935,6 +932,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; } -- 2.32.0