Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp61516lqj; Sat, 1 Jun 2024 08:05:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWqLfMSShwLcPvUVQrLYYqjw3QT3khf3m0HQi1aMipcrXfovX1eLO9YUtOs5GJnwyORM4shGlR/aonNhU07XHpUVvUKpQ26aBmhwZHmQg== X-Google-Smtp-Source: AGHT+IGWmcM79MifGQXjjM/By0DkIpsXUBVipiJxwO1KM1Sv3Bn0H2bRYAVhGDqaxec8DHEAdQEg X-Received: by 2002:a05:6a00:450c:b0:702:4c10:38be with SMTP id d2e1a72fcca58-7024c103b4dmr5570866b3a.30.1717254330122; Sat, 01 Jun 2024 08:05:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717254330; cv=pass; d=google.com; s=arc-20160816; b=Yi0HKWoJOFaXt6stjsWcxrJ2+qf+z/Tk8QKi+nv1yGEbw6m3aiO0V8uANuBKi5Aw0H kCH8bVY3Y+Bq1CsBlIKphIUWJ+bB8pwzdcDX0RrCifr2QcHE0kreLpF2jHTn8ClSSbtW p7TByFVuG5Bqx0WvjXVH8WyVi64ivbx2bLzCPra72o5LQt83KLkTalFNUDs3sUtutzBq CaoNENrbBEth4XEcB+cuUK6n3jW/+KwjYhkYrQnJ9KDmvhnPXXlKyT7FOoNAANPKqmp6 lTCsLRPQx7AcuDDWihUUqKMcZa+jOdb65IBiLnfCjuojvJT7mEOnjiNfvZQPmmwN+aeO hWJQ== 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=3Jv6JEZTD9c0qG8hE1F4MREKLvC6gRJSU0R0wzEFNGA=; fh=FlkUkdfW4x0nguZ5pbLqqxjGnkNm32FkUkSuBW35Jnw=; b=BmH0mPXkGdwEz1HZW2Lw0YV/yxmkCO6dpYdmIeoCYXN7wF/Ensq2JSSKmlEVcNZaFy Rj9TWxge6vbxpGv+Pb0TJeD6/YT8M0iwI6nXLPrhKfdHAOJOpHk0JRJsHlmiXt7rjlsz 0gdCGVFTTQnYEK7U5FdI6PyAxJgV+0hNQ2BlLGP8OMuerh/AmokCFuK6A34TmmvdPzoJ A6hctY8Qs5w/zyKAwAr4YjXx9imi+XXbiCVogY3QqcHJ3oHYyh6wc409UFBXr1OLE1mR /J/Ejiif9hP3HSC4Jry+fiveMxhj8rXZh0gOFmLuAyDTaBW0WvqX3sU1/CJs19n4hA68 ph+w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=KslEvNaR; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-197909-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197909-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c3540facb1si3507403a12.48.2024.06.01.08.05.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jun 2024 08:05:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197909-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=KslEvNaR; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-197909-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197909-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B99F228313F for ; Sat, 1 Jun 2024 15:05:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 985BA153560; Sat, 1 Jun 2024 15:04:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="KslEvNaR" Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (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 9763C152786 for ; Sat, 1 Jun 2024 15:04:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717254292; cv=none; b=cVX11XAixplKoN8K8MnX9RoeW0AumppkFuDNybrfB8PvpHabjscrDgX+mcqw86AQQmWQmb5qgQb8vrVpb6fDTtlmvnjdyLMGASP7kBxSvLYOEt0vJKnEIxusuGzK6gCin1BcauLnGDjVVI9UhTCdZyVgB0IBQXb0xbfa2PmSI9Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717254292; c=relaxed/simple; bh=w8tlK1a9yLZeLFHvsoySlErb7PynOFkH2SuqLxkF9HM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=js/7mZnIPbBj+SsfmsPg/d1WDzAFDU15RlXKvEiKv2IHgGel7Sd0Om3fhusUBV84sttQ18nMw/a3hK02+pd088NUxC7xqsS69VsFNYuIwXPa0/Hz7izUMVmBVe7yeVItTyXuCg2dZeZjZ3sH3QRb3Ug1LjlwTs9oZhoAz0mZdr8= 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=KslEvNaR; arc=none smtp.client-ip=209.85.216.50 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-pj1-f50.google.com with SMTP id 98e67ed59e1d1-2c20eed350fso173194a91.0 for ; Sat, 01 Jun 2024 08:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1717254290; x=1717859090; 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=3Jv6JEZTD9c0qG8hE1F4MREKLvC6gRJSU0R0wzEFNGA=; b=KslEvNaR0kKYdsI3AxhgEu+Xwg77Z981f5vIwgdYoruzR8XizlBzgbfemKxGK3QTnv AActfndcpgN7mGaBih5JGQI9MSecU2XCX0q3f2/HrU7Zz6G+Wvy5gaSPaDpw/Ouikrgi lKFcv3SYof9nrffZjCI/yoyiITWRdQfsZiLyZAef/dYIbH4z2OriB5oyZZ38Y2bxCysI Dd4WgjkUWOabjepZoQwvg/BT75FBTUUib2E4O2FeyzQCjudl8jJKqdZxqeyuO00xzCg7 aaCjcHrt3wVV7EkVX9RlFn9ghyinw05Z2x/4DYo1wiQ1AhFAV6vID+aIm99V1MTk5g83 yzHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717254290; x=1717859090; 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=3Jv6JEZTD9c0qG8hE1F4MREKLvC6gRJSU0R0wzEFNGA=; b=K/zxdRPWx+lYBqtBgdFMBk3tM65eBFze1kBOf023PZI31XdWDpVf2wHCG624XKQq1x Aat2VaKuQHyTr7nQSWrGxJpexWFKHvv2rC6kiO7vtYCoYc/vzIGwn985p9GHvlNYh/O+ QLN6BL/bwJG1kenN/MbIzHXRRk8XGtOFg9H3IPibkZlLvafiQb1Iq9yiNCx7ENIys9ow JfXVFIGyFZBTXWLaBfJCQOrf6EqOy3wYe3DcgGLY3I6hVIPMy/IQuxcTfKRX2qjCBBNn nI/lrJ//XwnWM4kcN/MDgklJZpgwCWyas0eF4daBQzGUFObcxRwV0arKwkPVnkTV63jz lRfQ== X-Forwarded-Encrypted: i=1; AJvYcCWdRfiSRi+f6/bjtghhNgI6dEoh8CMz63I/pwd4EbrzokrmMowZz7axm2nlKBXAV1dde1NPyoUCqii453cEDbPEanfKuRkt/tyMUlr/ X-Gm-Message-State: AOJu0Yxbbvs14kJEodnYnjBM6rr9I7UusbQx1fjG941Z+DkIcHMWf4y/ 5TtKVhzkC4hWRDfeZ2+itcDPLcu6Vw40+8VX5Lbr6bKVXNOnUhg3tGWdDI9UCkk= X-Received: by 2002:a17:90a:9a96:b0:2b1:817d:982b with SMTP id 98e67ed59e1d1-2c1dc5701fbmr4453498a91.14.1717254289850; Sat, 01 Jun 2024 08:04:49 -0700 (PDT) Received: from sunil-pc.Dlink ([106.51.187.237]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6c35a4ba741sm2559410a12.85.2024.06.01.08.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jun 2024 08:04:49 -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 , Conor Dooley , Andrew Jones , Andy Shevchenko , Marc Zyngier , Atish Kumar Patra , Haibo1 Xu , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Sunil V L Subject: [PATCH v6 04/17] ACPI: scan: Refactor dependency creation Date: Sat, 1 Jun 2024 20:33:58 +0530 Message-Id: <20240601150411.1929783-5-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240601150411.1929783-1-sunilvl@ventanamicro.com> References: <20240601150411.1929783-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 | 86 ++++++++++++++++++++++------------------- include/acpi/acpi_bus.h | 1 + 2 files changed, 48 insertions(+), 39 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index b325b297bf77..66038fc731fb 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -2004,6 +2004,49 @@ void acpi_scan_hotplug_enabled(struct acpi_hotplug_profile *hotplug, bool val) mutex_unlock(&acpi_scan_lock); } +int acpi_scan_add_dep(acpi_handle handle, struct acpi_handle_list *dep_devices) +{ + u32 count; + int 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); + if (ACPI_FAILURE(status)) { + acpi_handle_debug(handle, "Error reading _DEP device info\n"); + continue; + } + + skip = acpi_info_matches_ids(info, acpi_ignore_dep_ids); + honor_dep = acpi_info_matches_ids(info, acpi_honor_dep_ids); + kfree(info); + + if (skip) + continue; + + dep = kzalloc(sizeof(*dep), GFP_KERNEL); + if (!dep) + continue; + + count++; + + dep->supplier = dep_devices->handles[i]; + dep->consumer = handle; + dep->honor_dep = honor_dep; + + mutex_lock(&acpi_dep_list_lock); + list_add_tail(&dep->node, &acpi_dep_list); + mutex_unlock(&acpi_dep_list_lock); + } + + acpi_handle_list_free(dep_devices); + return count; +} + static void acpi_scan_init_hotplug(struct acpi_device *adev) { struct acpi_hardware_id *hwid; @@ -2026,8 +2069,7 @@ static void acpi_scan_init_hotplug(struct acpi_device *adev) static u32 acpi_scan_check_dep(acpi_handle handle) { struct acpi_handle_list dep_devices; - u32 count; - int i; + u32 count = 0; /* * Check for _HID here to avoid deferring the enumeration of: @@ -2036,48 +2078,14 @@ static u32 acpi_scan_check_dep(acpi_handle handle) * Still, checking for _HID catches more then just these cases ... */ if (!acpi_has_method(handle, "_DEP") || !acpi_has_method(handle, "_HID")) - return 0; + return count; if (!acpi_evaluate_reference(handle, "_DEP", NULL, &dep_devices)) { acpi_handle_debug(handle, "Failed to evaluate _DEP.\n"); - return 0; + return count; } - 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); - if (ACPI_FAILURE(status)) { - acpi_handle_debug(handle, "Error reading _DEP device info\n"); - continue; - } - - skip = acpi_info_matches_ids(info, acpi_ignore_dep_ids); - honor_dep = acpi_info_matches_ids(info, acpi_honor_dep_ids); - kfree(info); - - if (skip) - continue; - - dep = kzalloc(sizeof(*dep), GFP_KERNEL); - if (!dep) - continue; - - count++; - - dep->supplier = dep_devices.handles[i]; - dep->consumer = handle; - dep->honor_dep = honor_dep; - - mutex_lock(&acpi_dep_list_lock); - list_add_tail(&dep->node , &acpi_dep_list); - mutex_unlock(&acpi_dep_list_lock); - } - - acpi_handle_list_free(&dep_devices); + 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