Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp71069lqj; Sat, 1 Jun 2024 08:22:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU0wY+mf+qsM4i1tskXAeou7b1gaq5Z3bN997uONKdFsv/WXKBU2og/5qBwhBt7nKshLZ+YLcrXywJPI35BXoGOMNOHgan8J7mpekU2Ug== X-Google-Smtp-Source: AGHT+IGMG8KHRVbCg7+T8py3760S8DNmvuzZwJlTaSVq+AMKoHb5LRJJTZpU86wyHCUV2DyKtdYh X-Received: by 2002:a17:906:cf8f:b0:a63:42b6:20b7 with SMTP id a640c23a62f3a-a6821f50ffcmr310045566b.47.1717255375015; Sat, 01 Jun 2024 08:22:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717255375; cv=pass; d=google.com; s=arc-20160816; b=tWCVEmXBSZKxT+AO82Z2eUuGPdUf4A0heu9/YUxJ2kJAhA0tKIBlfoeMzlB/iWZe4C IDaxSfM/UhomuaxgbcUCV4TDr9W6qAnlOKvcCLKIVQ5ILc4GfX/DSCexZAFzReCGoOIT eEd6TfplicZ+XvidzdXz6pqfPrDcZfOxlRyGMfD+dfXJ5qcDsybETTxJI/vG16Jsc9Xj ftfUeTqrt18eajMbE5cOr8j8Nm8UE3gqZtmY+rQ8vONd01MG0c9VfGSpjfcqtxmTvBI3 C3St9vq09ndnsEAbVvo2Hy5wjFKO6zMy4YRXd2sjTQRFIcthps7FvAQ5JQRdV9wSZ1vx NKEw== 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=MFsOtJr39QOitF1KwZRd+YQFJB+PCc/GRrrdZlZj/hE=; fh=GARACBHBiXxNEOVfZbR+kigxNVYREX0zl49glYUTG88=; b=nCjqp4Ng8yJZgDhwkJ33VQPOCVUT8gebnGv4X5uPpdhQDuk+yC7ssd/El0EgIHiooX tV6Usgbqn6vAb1U8rb7qx+wMMv+o+2+I7PF6XcfWTZ4KcLkHPL6EC9b89sfD7USE2zxH zfn14LGkV1s5XbU6+9WsWDhdSp0PZozLyyhp5y/sXMV+5UZxjrSFG5XvRPwbNGw04M+F enB2JrrPkjgNyImyjkukOmxUUPkjyKZYez/aaU6vRnQ7q9+saplOdOVokkz1if6ro5+4 V/McZ3TUA8KM8/RA9c82ttpLNT3a6WkC0jaDZbU3srruAY2NyEFxjVTeQi0zkbRPq32C 6o1g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=cLQiEm8O; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-197914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197914-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a68c20a71f9si54213866b.191.2024.06.01.08.22.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jun 2024 08:22:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=cLQiEm8O; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-197914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197914-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 9D7E41F242CD for ; Sat, 1 Jun 2024 15:06:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C94DA154433; Sat, 1 Jun 2024 15:05:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="cLQiEm8O" Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (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 36185154434 for ; Sat, 1 Jun 2024 15:05:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717254327; cv=none; b=S4+D2yM8wvKFZFQ210L06Y5bT4gx9Y7n+QbQmC3OGGhpet38EsdFAi3z3LcmA64JosW9GTEyU1g418UAC3NuC43faeaKR9HgKrbCrjlBiwWUbeHO34LvH7y+OP6I7A69/QbFZ2iiGcRXel/4xCFKlcUTTm2Hgz/pObstO2EH28U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717254327; c=relaxed/simple; bh=+0+8uWNJ2E+sjIHYLQXKU2enWqx4IjoPosf2UhC3Spk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hITzwUSiNRvDh8Hohsrpf/9pbbhWx0wZxjfQqJy5xgPhgZ9HBH81W6TSU2QqDs4JvBjac8hd/A0dDNZAh4uGhp6ZE3TnF/NMERBpONhxS8oK2vf3Ggot2RDj9/jr4KdiwWITlS0PgdcfgsB1NEElXtLQsOj1zyJWiv5RZ7294DA= 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=cLQiEm8O; arc=none smtp.client-ip=209.85.166.177 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-il1-f177.google.com with SMTP id e9e14a558f8ab-36ddf683ad7so12232725ab.2 for ; Sat, 01 Jun 2024 08:05:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1717254325; x=1717859125; 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=MFsOtJr39QOitF1KwZRd+YQFJB+PCc/GRrrdZlZj/hE=; b=cLQiEm8OEAHxfVTilg5ESUxqmJF7bYDnUuYX8ogTc75pi+gEemHahyNcV7YJVoJ/+d TtnHft/IfOl8GvBDJwV4trEAcGfl1oW85isIdjcO21ZeBGn9UsOvtEHTRxLp9I4fhpDi /aenex4FaNFTp4YPNTPHhGahFUx2HGgAqBVRsRs7xwPnKlHe5Thekz8npHuHZYSZfXuz oPGyWBCpJEusuA4FgDgMoNI7V3i7hWfMgea3QhZZ5XY19NkwxZzqUf5amVjmq0K/mrTT fD1kImnb23MTRluax5DkdzSwuhufAmocO362AymHAFyhRqFHk8oESPzfnQvLK0Y/WMJI t4jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717254325; x=1717859125; 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=MFsOtJr39QOitF1KwZRd+YQFJB+PCc/GRrrdZlZj/hE=; b=bGdOjTuHlVERxpj0I/WrVwhNf/XMpwCeOatCm6knPG9SN1xqU/Hqycb/mZ70vJDCjA YF2e+QOYBEjN/k9XT6gowlP6tGTzJ6/hXZeJduXq8SiGMl/coTW8Zhykn5EKWFIXhNq7 jFepDnnTGjxayPbrcTvutkbSUQv5v8WA5VxoUZYSvomcpn5HRDAYMT99MofIVIUngAUR Iuw1n8JZryWLLlCbFqAEkQjHwkeaSOjdWCX0w1XzWHmI0zGYzQV03OKLtR7hpFkSMvQt m6GiJMwBPbFDEw1H1zKDJ380kBcfAvCExuJNkF5NxEOcv2E45X2uaYretrltDpPaKoVh MBOQ== X-Forwarded-Encrypted: i=1; AJvYcCUp4ODNBGLbmzOy4Apfnalzh6iig5zpGERit//0gbtds8BgyFz05ZxBLPcfQ9WHJQX2pCXSP4d2ToBEVP5Jb+4l7vKqsoucVKrOlgap X-Gm-Message-State: AOJu0YyXJhnpyyqB+edG6GnosN7985HZRGJHIZ+CmXYHKb7ktFwhUJGJ Oq8LK3vCY9hu/4mHICF3yXRfeJFERWaeZXVO+cMRo9FXVjz1KHUf7NpBtX5Jt/Q= X-Received: by 2002:a05:6e02:1d0b:b0:374:593f:913e with SMTP id e9e14a558f8ab-3748b98e53dmr55865925ab.14.1717254325230; Sat, 01 Jun 2024 08:05:25 -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.05.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jun 2024 08:05:24 -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 09/17] ACPI: RISC-V: Implement PCI related functionality Date: Sat, 1 Jun 2024 20:34:03 +0530 Message-Id: <20240601150411.1929783-10-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 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 | 33 +++++++++++++++------------------ drivers/pci/pci-acpi.c | 2 +- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index b94176e25be1..f143fbeea572 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 @@ -181,6 +182,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); + + if (!b) + return PCIBIOS_DEVICE_NOT_FOUND; + return b->ops->read(b, devfn, reg, len, val); } -int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, - int reg, int len, u32 val) +int raw_pci_write(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); + + if (!b) + return PCIBIOS_DEVICE_NOT_FOUND; + return b->ops->write(b, devfn, reg, len, val); } -int acpi_pci_bus_find_domain_nr(struct pci_bus *bus) -{ - return -1; -} - -struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) -{ - return NULL; -} #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