From patchwork Mon Aug 12 00:59:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 13759953 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 28269C3DA4A for ; Mon, 12 Aug 2024 01:04:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type: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=iVnO8D9tH0sab/WeUvbej3ReIYXoTsQSEaRkiw5yKWo=; b=pB3NEj/91mLGu0J1MoU8WIj8fF uQyDMve+9jq0HxeONR+W2xung7DQZgZxF3PJONu/4xnn+QVRI+Ft3u1zCH/+fdoPbBgntQp37bWmM AHPT1vf3t8feCoEYRgZe+RwITruFZkNTiSDdUXinR79xyKxA0c0NfP7Oo8hUt8X1mE8Ft4e6Z+6Xr f0iUqvE1NmGYE4MWBtVKOYleT0am2YTdCf+F4vtOKq7+SWSLR9SBZjadZum4euE5/TWn/bw949boN 58dNb++l530FFS3gVFKkcnffVI7K2jM0OyAC16Ub2h5yhHPhevOB7Uqt9o0psyoHwkI08z8KeJ07x j/VtMkiA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdJTm-0000000GbZO-33IX; Mon, 12 Aug 2024 01:04:10 +0000 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdJQ4-0000000Ga1L-06UW for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 01:00:21 +0000 Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-3db35ec5688so2454624b6e.3 for ; Sun, 11 Aug 2024 18:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1723424419; x=1724029219; 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=iVnO8D9tH0sab/WeUvbej3ReIYXoTsQSEaRkiw5yKWo=; b=PDGh1BxxbdIhHoHT8s4NUda0rTY8E+SdvytRhN4M1FBwhU/n03jhrjA7JvQ6JwZbb5 FaBhNqGdvYnpvDSA2CemxWuOfRwAv5kP9XDyHe/thasgje4hkPl+zSwvxANhCPrGGi43 pgIAXWg3zNt4nZ3TKzP/lTcCSqChAfsvqtT8OVvrYjqzK+4t6UsHSRqmhs7JxeitIOl0 /Qm5d9oJI7GxyPgpyRgJAvguCdYuaPSKI+MnfsJQfcssbpKh6Iem8jJ2eZBZA0gB0s3T icwO+3nER61Wmy8rh7KQD2OOTXWl0LNhcAJIT9MZv0TDwDe2TIFmbjQEWp1V+jegCddh lTuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723424419; x=1724029219; 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=iVnO8D9tH0sab/WeUvbej3ReIYXoTsQSEaRkiw5yKWo=; b=ocmLtDb0Erdagu+6XWleypvh9INAhAz4yiDRqJHTu1kEplIfCSGZErJ4muXefTKjOo oc1xOsAjkcgMMksct8r5QSX4PBMGzbnwEqteO1SSwoi+PdyS3JR7cEWPx3T2Z6GxUqv0 tGCDC23Z9yUO9eGT54cCPTUUji1UZOGUy1azKmybcTLF4x2TCkNFZdUqok/PHqnDwIF/ LmorKuemmFpBRC1JhyyFFvSdtyGXseIWmNCLTcm9+Y5mssXpthWym63lHU6Ln9sh+y9G GSizcxadv8ZrQhcLXEx9y1Mxrri2yv/UvypLtFBqPvpupdj+srMEUW+75feYoan1vbYq fikg== X-Forwarded-Encrypted: i=1; AJvYcCX99OJm134N15fkHCLIRttHc07S/lD/03FhvLncfriomH78eVDNsXRaRQNDLb4c8OdxClmlq5Y1RTBAzTB8S3M+UIvZPSkF8et1xQ+o0CnxcDIvnAw= X-Gm-Message-State: AOJu0YxaQImG7TfzeBij3cmGZZbkcaE3Cw4s7VJ3sCQKmtATAinG201a BPT0lH2iI5B1TRxMFqEtkvG9JsIQ80BmtuOwBHdx8HQfRvi9XIraZ/lydHEfms8= X-Google-Smtp-Source: AGHT+IGgnQrX14dxOj3yn291622Lxvm1iCgbP6yN6u9XpX8bxmUnRZf2Nt8a7HJ6YawHB1+ioO6EHA== X-Received: by 2002:a05:6808:1513:b0:3dc:299d:c4fb with SMTP id 5614622812f47-3dc416ec02cmr12205900b6e.40.1723424418770; Sun, 11 Aug 2024 18:00:18 -0700 (PDT) Received: from sunil-pc.tail07344b.ts.net ([106.51.198.16]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7c3dbe8cbdcsm3074062a12.61.2024.08.11.18.00.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 18:00:18 -0700 (PDT) From: Sunil V L To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev Cc: 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 , Haibo Xu , Andrew Jones , Atish Kumar Patra , Drew Fustini , Sunil V L , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= Subject: [PATCH v8 06/17] ACPI: scan: Define weak function to populate dependencies Date: Mon, 12 Aug 2024 06:29:18 +0530 Message-ID: <20240812005929.113499-7-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240812005929.113499-1-sunilvl@ventanamicro.com> References: <20240812005929.113499-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240811_180020_089961_0FF0E150 X-CRM114-Status: GOOD ( 14.67 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Some architectures like RISC-V need to add dependencies without explicit _DEP. Define a weak function which can be implemented by the architecture. Signed-off-by: Sunil V L Tested-by: Björn Töpel --- drivers/acpi/scan.c | 11 +++++++++++ include/acpi/acpi_bus.h | 1 + 2 files changed, 12 insertions(+) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 39b3ccae9f79..28a221f956d7 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -2077,11 +2077,22 @@ static void acpi_scan_init_hotplug(struct acpi_device *adev) } } +u32 __weak arch_acpi_add_auto_dep(acpi_handle handle) { return 0; } + static u32 acpi_scan_check_dep(acpi_handle handle) { struct acpi_handle_list dep_devices; u32 count = 0; + /* + * Some architectures like RISC-V need to add dependencies for + * all devices which use GSI to the interrupt controller so that + * interrupt controller is probed before any of those devices. + * Instead of mandating _DEP on all the devices, detect the + * dependency and add automatically. + */ + count += arch_acpi_add_auto_dep(handle); + /* * Check for _HID here to avoid deferring the enumeration of: * 1. PCI devices. diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index d6a4dd58e36f..af72a5d9de99 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -994,6 +994,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); +u32 arch_acpi_add_auto_dep(acpi_handle handle); #else /* CONFIG_ACPI */ static inline int register_acpi_bus_type(void *bus) { return 0; }