From patchwork Mon Aug 25 00:51:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 35892 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 89464203C0 for ; Mon, 25 Aug 2014 10:06:08 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id et14sf111641073pad.6 for ; Mon, 25 Aug 2014 03:06:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject:cc :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=CRXUirnFXa2lsMJy1kLDujknpH0+GJusAE8IPa9MMbc=; b=Lhrm2fM2lV7VoDdhPDzOF0d8vT9l0+g8qq1gkdpcXiD7nVyoAduB03WNAsh74ug1Dg zJag9qiXzyfQTnanNzsH9/y6hu4tQz03ALkZSMczpj956cntuPEAGAkYMq+ZM/D5c7qy CESQM7QTNm44NWemSbheOFYcUSCOibxSfg9q7yMRSCGN03l0XMZxOGntsZvRu7l5sD4Z fM8yK/bjppKf+c42i317EGhHP9Y3GNskTQdNfX/n5muGJS36nQfYV1OidMg2Q3qZQrZR cLygORgMl+SUIfwj+ffWZwjCjVU3qzxC6rrgyw0QNg1Cn1tJd4zMYI8SKa7aGjKED4QD WzMg== X-Gm-Message-State: ALoCoQlQ5Q/YqsZyXntC4nILnQiuO3r+sc+JnmjDI5bAVyAtd2a/jS9hInGgxXq5U/hdo+xm//Ks X-Received: by 10.66.156.100 with SMTP id wd4mr13653171pab.31.1408961165234; Mon, 25 Aug 2014 03:06:05 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.32.138 with SMTP id h10ls585874qgh.87.gmail; Mon, 25 Aug 2014 03:06:05 -0700 (PDT) X-Received: by 10.53.3.169 with SMTP id bx9mr400154vdd.80.1408961165107; Mon, 25 Aug 2014 03:06:05 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id qc6si16193836vcb.85.2014.08.25.03.06.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 03:06:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id hy10so14890470vcb.32 for ; Mon, 25 Aug 2014 03:06:05 -0700 (PDT) X-Received: by 10.221.62.195 with SMTP id xb3mr4812047vcb.45.1408961164999; Mon, 25 Aug 2014 03:06:04 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp104866vcb; Mon, 25 Aug 2014 03:06:04 -0700 (PDT) X-Received: by 10.70.35.207 with SMTP id k15mr26732091pdj.5.1408961164037; Mon, 25 Aug 2014 03:06:04 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id or6si52662904pdb.144.2014.08.25.03.06.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Aug 2014 03:06:03 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XLr6k-0008QB-1F; Mon, 25 Aug 2014 10:02:38 +0000 Received: from mezzanine.sirena.org.uk ([2400:8900::f03c:91ff:fedb:4f4]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XLr6h-000847-8k for linux-arm-kernel@lists.infradead.org; Mon, 25 Aug 2014 10:02:35 +0000 Received: from cpc11-sgyl31-2-0-cust672.sgyl.cable.virginm.net ([94.175.94.161] helo=finisterre) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XLr6H-0005AS-74; Mon, 25 Aug 2014 10:02:13 +0000 Received: from broonie by finisterre with local (Exim 4.84_RC1) (envelope-from ) id 1XLiVT-00082L-3S; Sun, 24 Aug 2014 19:51:35 -0500 From: Mark Brown To: Anton Vorontsov Date: Sun, 24 Aug 2014 19:51:34 -0500 Message-Id: <1408927894-30858-1-git-send-email-broonie@kernel.org> X-Mailer: git-send-email 2.1.0.rc1 X-SA-Exim-Connect-IP: 94.175.94.161 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on mezzanine.sirena.org.uk X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.2 Subject: [PATCH] ARM: cns3xxx: Don't allocate PCI addresses on stack X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140825_030235_428389_2CD1ADE4 X-CRM114-Status: GOOD ( 14.01 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: linaro-kernel@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Mark Brown X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: broonie@kernel.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Mark Brown The cns3xxx PCIe code allocates a PCI bus structure on the stack, causing warnings due to the excessibe size of the resulting stack frame: arch/arm/mach-cns3xxx/pcie.c:311:1: warning: the frame size of 1072 bytes is larger than 1024 bytes [-Wframe-larger-than=] Avoid this by dynamically allocating the structure, though I am not convinced that we should be locally creating the struct pci_bus in the first place. Signed-off-by: Mark Brown --- arch/arm/mach-cns3xxx/pcie.c | 49 ++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c index 413134c..67964f9 100644 --- a/arch/arm/mach-cns3xxx/pcie.c +++ b/arch/arm/mach-cns3xxx/pcie.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "cns3xxx.h" #include "core.h" @@ -266,11 +267,7 @@ static void __init cns3xxx_pcie_hw_init(struct cns3xxx_pcie *cnspci) struct pci_sys_data sd = { .domain = port, }; - struct pci_bus bus = { - .number = 0, - .ops = &cns3xxx_pcie_ops, - .sysdata = &sd, - }; + struct pci_bus *bus; u16 mem_base = cnspci->res_mem.start >> 16; u16 mem_limit = cnspci->res_mem.end >> 16; u16 io_base = cnspci->res_io.start >> 16; @@ -280,34 +277,46 @@ static void __init cns3xxx_pcie_hw_init(struct cns3xxx_pcie *cnspci) u16 pos; u16 dc; - pci_bus_write_config_byte(&bus, devfn, PCI_PRIMARY_BUS, 0); - pci_bus_write_config_byte(&bus, devfn, PCI_SECONDARY_BUS, 1); - pci_bus_write_config_byte(&bus, devfn, PCI_SUBORDINATE_BUS, 1); + bus = kzalloc(sizeof(*bus), GFP_KERNEL); + if (!bus) + return; + + bus->number = 0; + bus->ops = &cns3xxx_pcie_ops; + bus->sysdata = &sd; - pci_bus_read_config_byte(&bus, devfn, PCI_PRIMARY_BUS, &tmp8); - pci_bus_read_config_byte(&bus, devfn, PCI_SECONDARY_BUS, &tmp8); - pci_bus_read_config_byte(&bus, devfn, PCI_SUBORDINATE_BUS, &tmp8); + pci_bus_write_config_byte(bus, devfn, PCI_PRIMARY_BUS, 0); + pci_bus_write_config_byte(bus, devfn, PCI_SECONDARY_BUS, 1); + pci_bus_write_config_byte(bus, devfn, PCI_SUBORDINATE_BUS, 1); - pci_bus_write_config_word(&bus, devfn, PCI_MEMORY_BASE, mem_base); - pci_bus_write_config_word(&bus, devfn, PCI_MEMORY_LIMIT, mem_limit); - pci_bus_write_config_word(&bus, devfn, PCI_IO_BASE_UPPER16, io_base); - pci_bus_write_config_word(&bus, devfn, PCI_IO_LIMIT_UPPER16, io_limit); + pci_bus_read_config_byte(bus, devfn, PCI_PRIMARY_BUS, &tmp8); + pci_bus_read_config_byte(bus, devfn, PCI_SECONDARY_BUS, &tmp8); + pci_bus_read_config_byte(bus, devfn, PCI_SUBORDINATE_BUS, &tmp8); - if (!cnspci->linked) + pci_bus_write_config_word(bus, devfn, PCI_MEMORY_BASE, mem_base); + pci_bus_write_config_word(bus, devfn, PCI_MEMORY_LIMIT, mem_limit); + pci_bus_write_config_word(bus, devfn, PCI_IO_BASE_UPPER16, io_base); + pci_bus_write_config_word(bus, devfn, PCI_IO_LIMIT_UPPER16, io_limit); + + if (!cnspci->linked) { + kfree(bus); return; + } /* Set Device Max_Read_Request_Size to 128 byte */ devfn = PCI_DEVFN(1, 0); - pos = pci_bus_find_capability(&bus, devfn, PCI_CAP_ID_EXP); - pci_bus_read_config_word(&bus, devfn, pos + PCI_EXP_DEVCTL, &dc); + pos = pci_bus_find_capability(bus, devfn, PCI_CAP_ID_EXP); + pci_bus_read_config_word(bus, devfn, pos + PCI_EXP_DEVCTL, &dc); dc &= ~(0x3 << 12); /* Clear Device Control Register [14:12] */ - pci_bus_write_config_word(&bus, devfn, pos + PCI_EXP_DEVCTL, dc); - pci_bus_read_config_word(&bus, devfn, pos + PCI_EXP_DEVCTL, &dc); + pci_bus_write_config_word(bus, devfn, pos + PCI_EXP_DEVCTL, dc); + pci_bus_read_config_word(bus, devfn, pos + PCI_EXP_DEVCTL, &dc); if (!(dc & (0x3 << 12))) pr_info("PCIe: Set Device Max_Read_Request_Size to 128 byte\n"); /* Disable PCIe0 Interrupt Mask INTA to INTD */ __raw_writel(~0x3FFF, MISC_PCIE_INT_MASK(port)); + + kfree(bus); } static int cns3xxx_pcie_abort_handler(unsigned long addr, unsigned int fsr,