From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (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 A64CD86657 for ; Mon, 15 Apr 2024 17:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713200539; cv=none; b=ucYvRuG3MJyNksTp+nrpI+4MXKKIJPSip1A9XnGZF2qVxwe/FGSHI58FSpMeVzHYCOW2jwVC0VcjWcZNFVQKDezcgQlbAhlDj9CkY2ZfANhl76YiKKIDHqn4WQL9LUAztmBj+Ppt7nU5+8UTB9LhCG4IQe6o1XEqCsP84IuzGUs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713200539; c=relaxed/simple; bh=2Gz5QkDmnr7hC62yIyTV6F1j/bp+6gUwdzqqwho4EiY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=i1/oaSGvHDJOeWLzkZSJtMTxZpddc4C5SKUQP1kzIGzkSsYShStxbWoCmTBD9/xW/TT1XzvsG1jiw0oM1hDzFwtXlyzYchjCfSdjKCKyP6ZuxfK1virWEs/JCt4jHKE3+1PcbRs3f9gTDJASyl6PUzFSutTbTR7f7Av0YKKBtjs= 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=ANTCjPON; arc=none smtp.client-ip=209.85.210.172 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="ANTCjPON" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-6effe9c852eso927697b3a.3 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=lists.linux.dev; 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=ANTCjPONov84nFjrv72S660K+9HAVtrpN8Hc4VGe7e7lec7/LSucaOBf+P2Opitt9e VODdnhmoolmoAzD8haiPQu5rFRw3oYPbO4vqG0yp72sbXVN6uxFgbSjHTymaVe+yE+5H 9/z0f8SILLeH5TmKdMOqpRgxDSJPRnGGzyWp+IYlX+vN1SXd2qmRZhqJ6gN/O9BxkFRI Ww1IjUxF/VdzEmm78TDoQLrdtafzUlDMF8ozh4AKTXZSHcKbE8s+8wehjTzafxEcJ2Db MbYDk74xDhj/NwgKTISkiEXYpgBpdGBz6q0In5SSoI4epv56nY1fN0vmdb8VpOCYwi8j hmxA== 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=YYHB80EbM1H9lFxjSya/+xb9hh+ql9lbVBN6JDQrhWsYgxvwL4ag8P8KdOUfiThHRH 5evUw+tDagmX6fTctcwyUr5QPVVfAr2DzfZsGDsbagtZz9avoU6xztGjse0NeyphFynb 1C1pkZmXqu01d4kWFkxxaCVGeDd0JCia1HYGxGFweGxQsMX8prmN3uNzh7D7V46gElgY qZ7myohuw1YRTQ8CAV3Hnd3XyXfb8wR7a40kdbcVZ0SLpTUQ/gjdyn/mWR8Sc2Wa0oOu PqOg2bkpmFDBO/5Mby604TX63Sk7mwWK3oWHicKgWycv3AVtGSyftgcM2zDJeM2HUVAw PmTQ== X-Forwarded-Encrypted: i=1; AJvYcCXepZZygNB6h98wmVa9xOz5597f9L4h3t3EjhFSXd7JQQQw2hD4x+RwgZDa0A/XRCaqTUUltLh0r49oLnTPXvDbQD7UOiVr2pQc8Qn7 X-Gm-Message-State: AOJu0YzWrTQwbrkS+iOk6vNGF5mWJQeD0r1ddK6lCEWpazIzJ4Io3s5K bzalMznz/x33epPaZVfk8FCo4LQaeacvuM6JDt3XDsR81Fn8nDRNr4UTwsVoYf4= X-Google-Smtp-Source: AGHT+IEOKdv2GIoPVzAfszA+Mczkslu8VP2JvMat3iDp2rWUvNRo9ufo+FIpILZ6uWBafbyo9KluZw== 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: acpica-devel@lists.linux.dev 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 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 06F39C4345F for ; Mon, 15 Apr 2024 17:03:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=q7Phr3+Yous8fGrUAUgA9ng6dgu/Uhu1ShcFhnwGDTc=; b=vCvn8SUw1qtKy5 tkdJ/JumVJcT5CnAWtWBfNDFIn6vljU9S2zg9CIGVKSV0jQ+niOB3vMUaucghmsbRTd9ysA7RLoHB IMkmxtxWIG0/SOTdl8MpuCSXNS0+l3wEIPcOZhaOHoOhNCez2jfJ+GOo95/kr2ud7izpWvOl7SxDi u0Y7f/WZae0M5k2CSAWRgfNoiJbTqjkPcasmOTETjLfuRcVDwLA+9jut6rpQUSqLvGyKUs8ETMlWf b6Oooj7K9YwG/6D0AYU0Z8nq0fiQHBVO7dMd6ZAYvVg89KfZealIiKSVdyhMJe5cVvJLEoQb0spaR vpKviVSfQg8srYMHPuZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwPjw-00000009Cd1-2ujJ; Mon, 15 Apr 2024 17:03:32 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwPik-00000009BmT-3LgI for linux-riscv@lists.infradead.org; Mon, 15 Apr 2024 17:02:32 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6ecf3943040so2743239b3a.0 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=lists.infradead.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=iblOVtaB6DvGr+T0YQLc8/R21Naebi/mb7QCntIJm8rbj7niD4uVcxhmHSEMZIYd6n yTCPPZZ7uutZ8iA4hu1cVoa2QLjaiYu3O8RNn1Y+BCQpv44ztAevgE58ROh5c9fDI8mg gWjHoHoX+jWc6ubz63Co900IV8yiHjlUXq5mZzET7bn1fXexI70u7buGT+IJWhUU5p6H eE4RkpoW3Evg+3vyEKSto78X030qSKmBIaBlSgf7FhyDEdKEJYWOgA6qTThj17G8MLL/ DeL35AiGEV8PrHLg2cUnaVARAPqC2eoHLf7tRjtMFX6vEjw1tLy42juZhjVt9yUln+iv E0tQ== 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=OAUd9Y/MKmZBr0uOdoEpgnAMaT1o8ue0ZxozrPmzR9wbZfc9Z/dpC3H3kqIC3sbr6p o9S2crW6TZsgQIhsTIvL08Pt7Hs+5kHELqnftSplzHKyMOdFMf05pJMt4BYoqppZkR47 6ZkGyKldPEa0Ol4jw7Inp98wdfmgI09Xw4OqSPgnB21XJ+0YX0Yn9oRBtHs5/TglPpBv ldGLkAyqTLewc6NhVQaRmWdtZaO5WtztlgV5TV5IwDdT6CD1UNZ7NVqNjT5cX2xfwRIH f53sHuIL3LzvAHrzzFFgYmPz0XqciZX+5dzIKqzxd0CHTOTA6D7BwIhFCnieWVBbrfOe YThA== X-Forwarded-Encrypted: i=1; AJvYcCVMv+UtdzK7ICKjDgxHoRgoChLbet7D8BcSpU62q9lpxqjnLWT94D+CfSWzQlkXljF/Rm6lXLR7TDKW/2olYOZvF4SXuKiDxR+N4X6XPpHC X-Gm-Message-State: AOJu0Yzsis4hzC4r5XFwYPWm7XBrinK96hQNDKieCQR5HdsKHsza2n9V sG6lJx6oHU/qlbG+rj+kUMmLC2F3t7xgRksgAOUQr5qhl3uS3N0YJaygz137NUI= X-Google-Smtp-Source: AGHT+IEOKdv2GIoPVzAfszA+Mczkslu8VP2JvMat3iDp2rWUvNRo9ufo+FIpILZ6uWBafbyo9KluZw== 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 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240415_100219_090705_B08FCCE5 X-CRM114-Status: GOOD ( 15.86 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Albert Ou , Haibo1 Xu , "Rafael J . Wysocki" , Catalin Marinas , Anup Patel , Atish Kumar Patra , Robert Moore , Samuel Holland , Conor Dooley , Palmer Dabbelt , Andrei Warkentin , Paul Walmsley , Bjorn Helgaas , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Thomas Gleixner , Andrew Jones , Will Deacon , Len Brown Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B029EC4345F for ; Mon, 15 Apr 2024 17:03:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rw30HxswU7y6XnaATLhD3iRwxLp5WoicQ8E3MKS+AjQ=; b=HwAUgKs7M8fzIN LGmYxy79LVr+Jt8biUeG1PKd8sOpKx3I5oGTh0a+QtyBAGcp/wWSNHgrPqgiJnjDvJqrlcSWD1BJD uuwrdGpm97u1Trtp/+787gr4Vs9BEojvcX14OcaOg+HEmWHCQGmVQstAZHkV+iussQMBI+TtvK8Lz pzAWQTuds5oHJHbbSmtWWTFsF3XfxHzZJ2Ng1Z1R5o5pe4MTTGsJSiFMLTxwPZx/wHScMnynOQ281 Bk8FE7yd1tqqRSJhxH6flsFwsBNNsYGx0VP+suqTmZsqpkA/C+oSyzsGmiGdztk1gHr2FU3crhUFn M/+MYd8tRFS5AXPglgzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwPjr-00000009CYr-1c64; Mon, 15 Apr 2024 17:03:27 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwPis-00000009Bqe-30Yu for linux-arm-kernel@bombadil.infradead.org; Mon, 15 Apr 2024 17:02:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=wQjMcgzCCX1zvyyhnfJhjMc7UuQWOWfTm7mVOWGolO4=; b=fK/80iBDevR0KCXfPRXjdQAifV KL0ePWuwI+uagHN+cXF/hIjFQ+y4LuX54zCb/stoKvLyBkLcQMQd8euCE0cv0Gvqsr9fG00VKFyGj 6BLbZLBAQ+eN56zK3KxS98KP+6IT/rc3X1sdce/u+dzh8Pox/CcsKftba56w1pB/0a6aPblVgLDg+ zPgqGXG7d90H85d6ba0a66RCnU68Ordat0Jl90yRu7fdE7M1AlV+WhkMtgiDuepDnN0Ot4yncVlE9 ce0KUPA1Pk8+xLBySMKBHIjyjjJD2hhkncW+OsdZHCxfnwUHwuAe2/9laM4gXzPtFSTyR4IdxN0OG E97SKdBA==; Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwPim-0000000AfTU-0Gek for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2024 17:02:25 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6ecf406551aso2788671b3a.2 for ; Mon, 15 Apr 2024 10:02:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1713200537; x=1713805337; darn=lists.infradead.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=iblOVtaB6DvGr+T0YQLc8/R21Naebi/mb7QCntIJm8rbj7niD4uVcxhmHSEMZIYd6n yTCPPZZ7uutZ8iA4hu1cVoa2QLjaiYu3O8RNn1Y+BCQpv44ztAevgE58ROh5c9fDI8mg gWjHoHoX+jWc6ubz63Co900IV8yiHjlUXq5mZzET7bn1fXexI70u7buGT+IJWhUU5p6H eE4RkpoW3Evg+3vyEKSto78X030qSKmBIaBlSgf7FhyDEdKEJYWOgA6qTThj17G8MLL/ DeL35AiGEV8PrHLg2cUnaVARAPqC2eoHLf7tRjtMFX6vEjw1tLy42juZhjVt9yUln+iv E0tQ== 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=djvvFIxIjHrT/5jpML0wRKeqUJty1eblRIMKJq7/Um4RDHvUxJAbZrlvxP0uKl4qXF 1p6oPd1knnqBHjm23BZh9WjjAUEKwrYqkCcGSMy1CvAfsb9g71/vxr+s5Bv4DeuxYqDc 7ZNXRtWNKKS1pUuTr/lCwk4OMsy0R0q545BoqoP/c0YnlS52fdqlyg/PCkwI1RuYsYJz VKgA9iFah/jK0R04764Y5Nu2bnsfgt0LitXy/2CxGOSdENdy1RlDYnh5wcTZBeYa/dVL IwpxUmGaWmyh6FeJQH3e54Awej+nhYd30xOEsfP3an57pkic4EJCnMJ1RIJqvNcYbTgR ZAfg== X-Gm-Message-State: AOJu0YyuKxwmuIRWb4DWJDfACy1YuAs2ZeCe0ecB2OupeRpZr1kV8y3S I8eKFlJMaper6k+T4WHZ2/aQm+NOgw4pIoapmgaPLbH7WXqWMg/8H5qLhg/vfjtShgGpW+/7SdO eK8I= X-Google-Smtp-Source: AGHT+IEOKdv2GIoPVzAfszA+Mczkslu8VP2JvMat3iDp2rWUvNRo9ufo+FIpILZ6uWBafbyo9KluZw== 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240415_180220_308503_24BD674D X-CRM114-Status: GOOD ( 17.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel