Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1573509lqp; Mon, 15 Apr 2024 10:09:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXdMZKI/1giEP9ZN/M2pzePtZNiBYXJPnpkp4QQMzqnJ/K6IlBCrRywMRDWzYIjJMJFEUbw6cGMiuoVrWhe+SshN/0RqcJQ+6/igA0fCA== X-Google-Smtp-Source: AGHT+IFaFqk2cTunXSEyG6+ZncY2RUI1u2/+mGK/dJ8DSS5cnVbspzrrDmpU1MW9IVey88LyMyUa X-Received: by 2002:a17:902:a50d:b0:1dd:5f85:118c with SMTP id s13-20020a170902a50d00b001dd5f85118cmr8858764plq.62.1713200956445; Mon, 15 Apr 2024 10:09:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713200956; cv=pass; d=google.com; s=arc-20160816; b=nwgOG2KW8kg3c1NTBeaCSs1AZ/LBJpBuCUrXo4UIbFViNmTwysgl/fY+hHnQCX9Nfc XlGeRA2fR8m8J17SuMB5JkvwZjvf1L9esRZwKF8jJpleD06QgM9hqZxzHtWUdYO+Q012 pXXHJicwz7qNOZI0fnivw1v3PJywX9bjiAZLeZfdDkM6uBYfQoAevcaRtsGuLBk1D3Ic CxYuTqSn0RBV85yu9tUauhzoWbQXePA3TxAOxKhgUM3ltd+ly1/k71pFNjSHU6CCRhWo v5hZNksxo6f5ZhhKMR0ST2+FD2+Gv256GAq+Epxm8c3cMtmEwYtqPyJD4Eqmw/gEn4IA 12eA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=wQjMcgzCCX1zvyyhnfJhjMc7UuQWOWfTm7mVOWGolO4=; fh=nwbv7qYnAd7fOZIKhGciVO6X0Ru7qRD31Gabtu2P478=; b=rEv9AzPZ3kGWn7qlGzezu9UM2616gvxVqR/mG7KUwVZOQ6DH8oNMjxNJWmAM2JActM GxiDvKm4q9Ki0YSfMkcyQdPj1GL3T8EmWjFYrXyrZHpI2B637LsW7wRp1wGbKA+JUVte OVZmKK3V0kv1A+3uXXMTw6rJMWJOgP00vzmF8PseZcEJEPpTe/L0QxFmYaCmCueDg7GZ ZXBlIcCSxi3pNfyHdviq2OldzFBM7XqMdUPkepq+8e2jB7fYObr7+dhw3WhUP/gZxgYj FT7G/dxZfs/XdkABK7nLs4w9VaTLRkt8nh8LMIkQ1Xx9Ffve8fh3DMz5nzlaptM9lHv9 E4UQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="g8VaR1/m"; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-145608-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145608-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id e13-20020a170902ef4d00b001e55d0f42c5si7815828plx.168.2024.04.15.10.09.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 10:09:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145608-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="g8VaR1/m"; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-145608-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145608-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7F1B2B242C1 for ; Mon, 15 Apr 2024 17:04:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C1D8F86AE5; Mon, 15 Apr 2024 17:02:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="g8VaR1/m" Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8730782C8E for ; Mon, 15 Apr 2024 17:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713200538; cv=none; b=dI4qZ5gs9GlwHpuY+0j5yXeQZzDLCOTSVbFZ83WtJ//VE2K5YOMujPzpvY1vL8Y/dzqENDGcBBe8FzWASQ39DWXhs9NarU53bGSey7Lea4fmnpd97tDQggH7sgQ2nWiAkj6BS5TUwkShW35CBi5vIFbgVMVMw3blcGO+l4ADHM0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713200538; c=relaxed/simple; bh=2Gz5QkDmnr7hC62yIyTV6F1j/bp+6gUwdzqqwho4EiY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aYMNuMoWs7AMRGK9kr4q2XXPxsdmaxwupG2XFt0VMS9FmrjCrIQD8e+lP6x29eSfsM2crn4k0m0FkWsU0eHA2d3qhsluojsR5iXeSr/bERlpNOAet5k0L262QH7nM18rtmGGDro9HGMlUEtTo1Lhm9z5P+6GArQRyKa3xTkOrDc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=g8VaR1/m; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6ecf406551aso2788655b3a.2 for ; Mon, 15 Apr 2024 10:02:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1713200537; x=1713805337; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wQjMcgzCCX1zvyyhnfJhjMc7UuQWOWfTm7mVOWGolO4=; b=g8VaR1/m3IE/227Bo+gzhO/WkqQiWRT+aN5TF6XOdmS0ACj8BJfeGXzAvjNJkWUeRh WihRMp590qQS3MpkgRKqdwavMDkkz0HIHFioE9TgjFtCR0VypVzIejirZ3AQJSgm5fY0 gEXGMz5A8FrhDEQO2+YPVlyjg2pMJthxpkgaEsvbxobMy2oqgMVu5tz0mLu/Ue+/ntfv GX7OkZvx/8uyJsT+oxuNI7kC3VjR6L1U2YRFAfA8IP+OVTmm7XeTQ0k64aalN+EZCftL FERWHQlSfdrPazQXuuwRQO4jcMPLOk7N8tcQiFE562urEdoA9KneK1UlKO8sxU2RHL9j 8Gbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713200537; x=1713805337; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wQjMcgzCCX1zvyyhnfJhjMc7UuQWOWfTm7mVOWGolO4=; b=PP5WiPakUEwKJNJtqHhtP5UKcs6kwhJo3B7Vh+Uoo1DouNpUMCs8YEptzBxxEA9+C8 Z3O258oC/99oax+/+FpNzFMcT9OP7tUB4r9CuKPfI5EGw2N9iphCO5VEmZqds0H92aZT a4D1eDfYDiEJUunuGq3AdqmBakiu772wINPZ3Kb21QakmMl8tJccS+ZdinmZUv+YFrKC /gNdakEt6RpH4nj6yYU6DrIV2yprNSj1sLCrqiNz6TYUjGGPcVUZG3Gz7Y+mxOJ09o50 TXtxTBIVrb+fjDRuG6ICwyjh9BSFHjSh9hMo87f5clxfiwgS5ZvOZL4ezkCYHCi3uWIc Z5iA== X-Forwarded-Encrypted: i=1; AJvYcCVIVzn7LM+hknpBnRDsE+Yq4/4cOqBl8S6rsTvGKb2kSOPF/TnZLRVZqk8y9G5/EUTNcYb3Gk988jXcVspSJV5ku4Fkpozj6NJ9BFgG X-Gm-Message-State: AOJu0YwWCtu049E5p0eLSTD+b+4WVRr7CmY7zI0b/rSGAfHGJa0RMSqO RidHY0KISrG0aiFyy80xks08KLaafugj0L4+nY9j+Bjk7qWfVYqyxcZTCUzJBW4= X-Received: by 2002:a05:6a00:2314:b0:6ec:cec1:8fe3 with SMTP id h20-20020a056a00231400b006eccec18fe3mr10562037pfh.11.1713200536823; Mon, 15 Apr 2024 10:02:16 -0700 (PDT) Received: from sunil-pc.Dlink ([106.51.187.230]) by smtp.gmail.com with ESMTPSA id 1-20020a056a00072100b006ed045e3a70sm7433158pfm.25.2024.04.15.10.02.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 10:02:16 -0700 (PDT) From: Sunil V L To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, acpica-devel@lists.linux.dev Cc: Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J . Wysocki" , Len Brown , Bjorn Helgaas , Anup Patel , Thomas Gleixner , Samuel Holland , Robert Moore , Haibo1 Xu , Conor Dooley , Andrew Jones , Atish Kumar Patra , Andrei Warkentin , Marc Zyngier , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Sunil V L Subject: [RFC PATCH v4 08/20] ACPI: scan: Refactor dependency creation Date: Mon, 15 Apr 2024 22:31:01 +0530 Message-Id: <20240415170113.662318-9-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240415170113.662318-1-sunilvl@ventanamicro.com> References: <20240415170113.662318-1-sunilvl@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Some architectures like RISC-V will use implicit dependencies like GSI map to create dependencies between interrupt controller and devices. To support doing that, the function which creates the dependency, is refactored bit and made public so that dependency can be added from outside of scan.c as well. Signed-off-by: Sunil V L --- drivers/acpi/scan.c | 48 ++++++++++++++++++++++++----------------- include/acpi/acpi_bus.h | 1 + 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index de30a0af7a2f..c8f40d81b6cb 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -2028,33 +2028,18 @@ static void acpi_scan_init_hotplug(struct acpi_device *adev) } } -static u32 acpi_scan_check_dep(acpi_handle handle) +int acpi_scan_add_dep(acpi_handle handle, struct acpi_handle_list *dep_devices) { - struct acpi_handle_list dep_devices; u32 count; int i; - /* - * Check for _HID here to avoid deferring the enumeration of: - * 1. PCI devices. - * 2. ACPI nodes describing USB ports. - * Still, checking for _HID catches more then just these cases ... - */ - if (!acpi_has_method(handle, "_DEP") || !acpi_has_method(handle, "_HID")) - return 0; - - if (!acpi_evaluate_reference(handle, "_DEP", NULL, &dep_devices)) { - acpi_handle_debug(handle, "Failed to evaluate _DEP.\n"); - return 0; - } - - for (count = 0, i = 0; i < dep_devices.count; i++) { + for (count = 0, i = 0; i < dep_devices->count; i++) { struct acpi_device_info *info; struct acpi_dep_data *dep; bool skip, honor_dep; acpi_status status; - status = acpi_get_object_info(dep_devices.handles[i], &info); + status = acpi_get_object_info(dep_devices->handles[i], &info); if (ACPI_FAILURE(status)) { acpi_handle_debug(handle, "Error reading _DEP device info\n"); continue; @@ -2073,7 +2058,7 @@ static u32 acpi_scan_check_dep(acpi_handle handle) count++; - dep->supplier = dep_devices.handles[i]; + dep->supplier = dep_devices->handles[i]; dep->consumer = handle; dep->honor_dep = honor_dep; @@ -2082,7 +2067,30 @@ static u32 acpi_scan_check_dep(acpi_handle handle) mutex_unlock(&acpi_dep_list_lock); } - acpi_handle_list_free(&dep_devices); + acpi_handle_list_free(dep_devices); + return count; +} + +static u32 acpi_scan_check_dep(acpi_handle handle) +{ + struct acpi_handle_list dep_devices; + u32 count = 0; + + /* + * Check for _HID here to avoid deferring the enumeration of: + * 1. PCI devices. + * 2. ACPI nodes describing USB ports. + * Still, checking for _HID catches more then just these cases ... + */ + if (!acpi_has_method(handle, "_DEP") || !acpi_has_method(handle, "_HID")) + return count; + + if (!acpi_evaluate_reference(handle, "_DEP", NULL, &dep_devices)) { + acpi_handle_debug(handle, "Failed to evaluate _DEP.\n"); + return count; + } + + count += acpi_scan_add_dep(handle, &dep_devices); return count; } diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 1a4dfd7a1c4a..28a9b87c23fa 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -993,6 +993,7 @@ static inline void acpi_put_acpi_dev(struct acpi_device *adev) int acpi_wait_for_acpi_ipmi(void); +int acpi_scan_add_dep(acpi_handle handle, struct acpi_handle_list *dep_devices); #else /* CONFIG_ACPI */ static inline int register_acpi_bus_type(void *bus) { return 0; } -- 2.40.1