From patchwork Mon Aug 12 00:59:21 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: 13759962 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 7CC43C3DA4A for ; Mon, 12 Aug 2024 01:05:33 +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=Ig7Nyh0Lix1wFtgFD/mV8Htlgv+BpsAkaEdnH0asbsA=; b=tmMqzA5kjdGUzM LEmhCONYl/Usl2Upwt8mJD6wBmEp2f+ODJobOGkB6NvmELsjeefPaq8DfLNF4LRJJhg/zt2BcoMI8 U2bvTwy8q/GibgPJg48tglf4+RO2flRDlwcpQdjAiaWmt32Bl7LX2h01CFfxvddl0h176/3iZVbgC VbOFyLfoy5t8wr+AUk9447EVjuwzJR0MANZK97F5Xkn1mHn8w8Fw9dWUF8M/jxtKAuTu3SU8trg5m EAOjD2cmr3vwYL/JvMvAXN9GgMPafSc+jIHHGMp2pJ5zO9gxogknbqT1D+5Rd6xdjHf8OyYk/AEVC 53DhdTY3q1u2yR/x6Bpw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdJV4-0000000GbtR-3WkG; Mon, 12 Aug 2024 01:05:30 +0000 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdJQM-0000000GaAZ-4B7d for linux-riscv@lists.infradead.org; Mon, 12 Aug 2024 01:00:41 +0000 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3db1e4219f8so2164465b6e.3 for ; Sun, 11 Aug 2024 18:00:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1723424438; x=1724029238; 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=3yHv4RQ+8m8uuAieiHb/ndAopbPkfvfPnrF/+OTZxeU=; b=ieLdqa8apK66DuwDSNsKIahqT4dyxxHmRFsZddYZnHeEzpASlUGhIz3A/DH9p7ZNXx BiIM/PxSw1xceZeWYEixLrIcgbdQXNCHIHxjMh2rktV9dYTXVlfb0py7hJSiw2bm6xl8 BmSTi6Yb8YyoCux7wUUgWe8B4fP5wsRAim5qD2i/e0PqX2REtLwQZPduHylRPcNbPyfb VE/gDOs57QOZb8ezIJPCYNB9oOFeivytm//jiQ0p0WrnuIISvpUccU/K4UY1n71wrmx9 o7wjUo+v5CEr/KEHXb83GFa5pseXYM7/RwyYDQgFdFimDcH0Xj94IxlVeuUgWqqqlRCf 4l5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723424438; x=1724029238; 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=3yHv4RQ+8m8uuAieiHb/ndAopbPkfvfPnrF/+OTZxeU=; b=srR5fQIK86KTW75kqeO1zZD9raCXnPxWyahXxZZgLBgG1OfGTFcYdLaWQel8EnKqXp SWKjA0X/Edw8ueTg607ZS3zOiacHn3mt7Nz5j2ZE+HaDkzCom4ehYGAKaxmZEPx4KrXY 9dw7OzJVsvdcpSrDOgPcI3CrUU/9LT0JtaA9VimIvH48FgoKb+E7gCkUhl7OLk/SKzlp /rHD9C0CR9/3DOFGYXjVYWEtMYQk5THfNM6+uPG3+6K2o6TeQRMopVn7I1CSed8SESkR xI7Q0yOwumQrhPbSBOmNNr+6l2k6cWq+RHqkW0GQZcEUz4ge0/sr1YkyFb+mWEhXW1xI 0ndg== X-Forwarded-Encrypted: i=1; AJvYcCUDc5NFRYPqsY94fbY8SDUsCSALbM/843fAxTDDAO3wUlx/qv8TrAsosGVW1AxyrU1dQYeEaZIJWrUNUg==@lists.infradead.org X-Gm-Message-State: AOJu0YzaBrwCS4CO1An3dhpVEmRkft17AhtIKog6UCQZXWdS5zcPnQ9O I4hCtuwp+D7EAS8bTKLUSAFzoVIXGxFmL3a1GMJmV6mGZh09dXrfTOS4nbEU6ak= X-Google-Smtp-Source: AGHT+IFun0gorfvtl1RVjdN/jm32amrHRkag2ROgDMVcRhqDHKcAfRdwMw49PRBtm4+7+S1MCEJ11g== X-Received: by 2002:a05:6808:16a0:b0:3db:fe8:f74c with SMTP id 5614622812f47-3dc41689574mr7836368b6e.24.1723424437728; Sun, 11 Aug 2024 18:00:37 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 18:00:37 -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 Subject: [PATCH v8 09/17] ACPI: RISC-V: Implement PCI related functionality Date: Mon, 12 Aug 2024 06:29:21 +0530 Message-ID: <20240812005929.113499-10-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_180039_079493_DAC69985 X-CRM114-Status: GOOD ( 13.88 ) 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: Albert Ou , Haibo Xu , "Rafael J . Wysocki" , Anup Patel , Atish Kumar Patra , Robert Moore , Samuel Holland , Conor Dooley , Palmer Dabbelt , Drew Fustini , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Paul Walmsley , Bjorn Helgaas , Thomas Gleixner , Andrew Jones , Will Deacon , Len Brown Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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 Tested-by: Björn Töpel --- 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 0f3cd7c3a436..a269e577284e 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_PPTT if ACPI select ACPI_REDUCED_HARDWARE_ONLY if ACPI select ACPI_SPCR_TABLE if ACPI @@ -188,6 +189,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 ba957aaca5cb..6e0d333f57e5 100644 --- a/arch/riscv/kernel/acpi.c +++ b/arch/riscv/kernel/acpi.c @@ -311,29 +311,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 8ed81a373bd7..af370628e583 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -1543,7 +1543,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