Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1568959lqp; Mon, 15 Apr 2024 10:03:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUxFgbCAYKll0lz4cfcaovKGh8s+ymXnbw/t1cSUGMs38WeTX1sEbpLnOl+RZ/tTfqTsk47aWsQiWpMv25z5ADXEPlAx4NInu2ZXowWyw== X-Google-Smtp-Source: AGHT+IERvtXaTUDl3v72XA6F/J3BnJfViKSeD/cbP8j7vPqPFwpv6u4zBqtMAC6L8Zuo1UwgoOnL X-Received: by 2002:a17:90a:ac13:b0:2a6:e639:ee6d with SMTP id o19-20020a17090aac1300b002a6e639ee6dmr7797428pjq.39.1713200580048; Mon, 15 Apr 2024 10:03:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713200580; cv=pass; d=google.com; s=arc-20160816; b=GGSj0gdE7gAL62LBYnE33e4Jh6tWLPqK7jU87BLq8HpqekJ/BA+jiANlCAyrQwNW7X rVgj4FL4Z84RAi5YIWie2Qm3EOVS+B76fYIPJfIlA4gJZQ9k/AGPKgnwAHNy3C0y5Wsj shwxYrNWOaZRd71kcLY2MCnUwMhY7pRGDBuhLbnSDCfiSPznEvbo2sH9dfgY9Jlh+nEe 2fAwcjw/ME1QnHFxpxDYC0Jin/DLmSGp25RelOl3J4EkkqIp4sNNhlKrZ6oc4/PFAWhn c5HamxNY+lf003Cabyqk9T4Pk9ygjh/2GPuTSDoWOACqJP5TX9XF3oZEBO26UML9qwmH bhVQ== 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=SFAtcNyUPfmOo+WuzK4Rac+GFz0TbHOwinmWYmcFrxc=; fh=HD8VRG/v8QxaiTyKJ6EV1lw1kn8ur9BBPQFaHqodVTU=; b=P6X++tzjh9ff3YzCIQWrPoqzP4usUUafeSlytDSnz6PbXNY6F6rpaxmeitV01t18yC HhDns9+m5Rheat/evw36OH8w0Ertza15NZ1bBVAIrcce9AuaqwEB5d8GJatHpTkv5n6w bfIqtSenPiXbya+sxfjtssfSYwC2VtO7MquQZkKRi7EvNv1ROyUAwBlUQq0IOkGHMbtb lFZu7Vsg9w3Jg29Egr80osLgkc0WcziDt+AbL05so77S9TCe2oRlZTbciiVFsjxq6KYJ WT7VOhnvSaAJ5CNxYeSVPsdIiVYKxhrfsK/QuLR7bjQgL/1TwIPFnS0zJi52qR89RqGF Ixww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=Ibq4yvZ8; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-145601-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145601-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 x20-20020a17090a531400b0029b51ab595dsi8290145pjh.143.2024.04.15.10.02.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 10:03:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145601-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=Ibq4yvZ8; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-145601-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145601-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 77A3F283F91 for ; Mon, 15 Apr 2024 17:02:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A6CC84A4E; Mon, 15 Apr 2024 17:01:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="Ibq4yvZ8" 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 2D33483CBD for ; Mon, 15 Apr 2024 17:01:38 +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=1713200500; cv=none; b=XcL9M9RkToknr3je3lyrNZGZt051wUx5inFPbsS/1UJEDug/kjOX4bL22SjOEiQ7UNGVEfw7Muc/dvTYfBFNYD6LDlYOXlmFZJ5j//1dLrtQFOaq+yZmGj/zUgaeuRWTUlvF13Nl8MKqkjUpUBE+aYlvsRMspG5RDkCDnNeAYZI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713200500; c=relaxed/simple; bh=d//fcv46H4LzOYIR8kFfFqlYP6RASRxKKzQCgxhHvNk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kYfMxv0FlqS77eQqg+r/FQCfzZnk0zqbU1XcUnUwQNyCellOZKgpNEK4mxDK4kXzquRK+BgvXZNg6tdPgyv98pjrIXeanWdzZP4sWkTIjYhfMagmPGMA1bv+x3F756FsWQ7N0a3Iu4/YKdMSeiMFMV09fRHm/xusbghARrsRYU0= 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=Ibq4yvZ8; 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-6eff2be3b33so1193500b3a.2 for ; Mon, 15 Apr 2024 10:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1713200497; x=1713805297; 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=SFAtcNyUPfmOo+WuzK4Rac+GFz0TbHOwinmWYmcFrxc=; b=Ibq4yvZ87GnCiGAJGBbAJR9dv9TRo9Rs12iETGjNcPzQimPMrc5TlCaQ7lB+7BSAT2 59mR0vmElr3Ia3cVyJmE5qExu3hurKvsCfUpWNitAQzsJw++lmOsDWE9pVriuN94FXv7 fqfGS74DHSI/7izzpM3KGQ1/gtQBqnErbC2OiIM0kymWAaspNrIUHxTDYOxzbpf5Y54H w6tp7f5DW0/UOSNWL8/vz/dhjCsMgwIcD7OpTvdfghNzTash//dXxcocXthNDyTMzvzy sLCjsxufKwSp/m25mRYjEI4/pUUSWZX5rXvJM/Kc8ljjWNt6yaevgG8QWabAZl5gx1zi Vy5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713200497; x=1713805297; 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=SFAtcNyUPfmOo+WuzK4Rac+GFz0TbHOwinmWYmcFrxc=; b=KTGPotrd5/0+RzHT97iTCXc4/H/UG8jCaEttq6LNHFoukhfQTj2Iaw7nsgQUEqZBOi KM0Fb1hT4AsAX4j73oLBz/T3MvNLS4lfyZh/YJbABPvRdzZAZugRpz4t4PvEPhbPPSRB y/s/Pc6MXDn22Bj/y2mWyO0GWynz3gDDLglZTzGtwun6RIieVFY1EF0GuW0GRnuleV1t yZ2pdAAdg8hp+ND9CqL59U/A3ztU+Za2hPIaquOaYIccI9Q+fhvOLaBqdvSd00t7nJqy bKWxUCIDT0miucFRAnx76iQ1/RjaQQW5kAg4aWnAy7/BYqvcbp24lHTcX0TK72DOA+Y2 1A7A== X-Forwarded-Encrypted: i=1; AJvYcCX7OJcFccx1b+wK7h28V5eZc8ybnGCUJWDxw7FoDN+QzljfnrEOx1HMnR3j2eB5SIhafkFCTuzwz9ft08FYjlvfl25hZKcgzqbxdh5U X-Gm-Message-State: AOJu0YxPuyIowAgDg7DA2sdSuNvU71LLT8TFe6r4m5k0wIMnrwuvNeUe 3zAoWDgxxkhYjSE+v3ACHESBHGkL3AYk3HzQd0AC4T88Ag78T8hCMJbNKRKPt4w= X-Received: by 2002:a05:6a00:22cf:b0:6eb:2b:43b4 with SMTP id f15-20020a056a0022cf00b006eb002b43b4mr11021959pfj.27.1713200496609; Mon, 15 Apr 2024 10:01:36 -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.01.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 10:01:36 -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 02/20] RISC-V: ACPI: Implement PCI related functionality Date: Mon, 15 Apr 2024 22:30:55 +0530 Message-Id: <20240415170113.662318-3-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 Replace the dummy implementation for PCI related functions with actual implementation. This needs ECAM and MCFG CONFIG options to be enabled for RISC-V. Signed-off-by: Sunil V L --- arch/riscv/Kconfig | 2 ++ arch/riscv/kernel/acpi.c | 31 ++++++++++++++----------------- drivers/pci/pci-acpi.c | 2 +- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 6d64888134ba..69cc0509a19a 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -13,6 +13,7 @@ config 32BIT config RISCV def_bool y select ACPI_GENERIC_GSI if ACPI + select ACPI_MCFG if (ACPI && PCI) select ACPI_REDUCED_HARDWARE_ONLY if ACPI select ARCH_DMA_DEFAULT_COHERENT select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION @@ -173,6 +174,7 @@ config RISCV select OF_EARLY_FLATTREE select OF_IRQ select PCI_DOMAINS_GENERIC if PCI + select PCI_ECAM if (ACPI && PCI) select PCI_MSI if PCI select RISCV_ALTERNATIVE if !XIP_KERNEL select RISCV_APLIC diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c index e619edc8b0cc..41aa77c8484b 100644 --- a/arch/riscv/kernel/acpi.c +++ b/arch/riscv/kernel/acpi.c @@ -306,29 +306,26 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) #ifdef CONFIG_PCI /* - * These interfaces are defined just to enable building ACPI core. - * TODO: Update it with actual implementation when external interrupt - * controller support is added in RISC-V ACPI. + * raw_pci_read/write - Platform-specific PCI config space access. */ -int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, - int reg, int len, u32 *val) +int raw_pci_read(unsigned int domain, unsigned int bus, + unsigned int devfn, int reg, int len, u32 *val) { - return PCIBIOS_DEVICE_NOT_FOUND; -} + struct pci_bus *b = pci_find_bus(domain, bus); -int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, - int reg, int len, u32 val) -{ - return PCIBIOS_DEVICE_NOT_FOUND; + if (!b) + return PCIBIOS_DEVICE_NOT_FOUND; + return b->ops->read(b, devfn, reg, len, val); } -int acpi_pci_bus_find_domain_nr(struct pci_bus *bus) +int raw_pci_write(unsigned int domain, unsigned int bus, + unsigned int devfn, int reg, int len, u32 val) { - return -1; -} + struct pci_bus *b = pci_find_bus(domain, bus); -struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) -{ - return NULL; + if (!b) + return PCIBIOS_DEVICE_NOT_FOUND; + return b->ops->write(b, devfn, reg, len, val); } + #endif /* CONFIG_PCI */ diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index e8d84fa435da..b5892d0fa68c 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -1521,7 +1521,7 @@ static int __init acpi_pci_init(void) } arch_initcall(acpi_pci_init); -#if defined(CONFIG_ARM64) +#if defined(CONFIG_ARM64) || defined(CONFIG_RISCV) /* * Try to assign the IRQ number when probing a new device -- 2.40.1