From patchwork Thu Feb 25 09:24:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 8421051 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8BD65C0553 for ; Thu, 25 Feb 2016 09:24:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BBDBB2028D for ; Thu, 25 Feb 2016 09:24:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ECC792034C for ; Thu, 25 Feb 2016 09:24:32 +0000 (UTC) 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 1aYs8D-0001Kn-8d; Thu, 25 Feb 2016 09:22:45 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aYs8A-0001Iw-4k for linux-arm-kernel@lists.infradead.org; Thu, 25 Feb 2016 09:22:42 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B756449; Thu, 25 Feb 2016 01:21:25 -0800 (PST) Received: from red-moon (red-moon.cambridge.arm.com [10.1.203.137]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 187FF3F213; Thu, 25 Feb 2016 01:22:16 -0800 (PST) Date: Thu, 25 Feb 2016 09:24:27 +0000 From: Lorenzo Pieralisi To: Itaru Kitayama Subject: Re: [PATCH v3] ARM64: kernel: implement ACPI parking protocol Message-ID: <20160225092427.GA31728@red-moon> References: <1453806638-23167-1-git-send-email-lorenzo.pieralisi@arm.com> <20160202182657.GC15706@e104818-lin.cambridge.arm.com> <20160203112112.GA18387@red-moon> <20160203161834.GB26487@MBP.local> <20160224141832.GA26630@red-moon> <56CE3C9E.7070505@riken.jp> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <56CE3C9E.7070505@riken.jp> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160225_012242_199348_01E48137 X-CRM114-Status: GOOD ( 17.17 ) X-Spam-Score: -6.9 (------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Catalin Marinas , Mark Salter , Will Deacon , linux-acpi@vger.kernel.org, Hanjun Guo , Sudeep Holla , Al Stone , linux-arm-kernel@lists.infradead.org, Loc Ho Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Feb 25, 2016 at 08:28:30AM +0900, Itaru Kitayama wrote: > Lorenzo, > > On Mustang the lockdep warning I reported to you is disappeared and > the system gets to > the prompt as you implemented, however only 7 CPUs out of 8 brought up. It is because, as I mentioned in the other reply to this thread, the VA should be stashed before setting up the mailboxes, patch below, that should be final (I tested it on AMD Seattle too), please give it a go. Thanks, Lorenzo -- >8 -- Tested-by: Loc Ho diff --git a/arch/arm64/kernel/acpi_parking_protocol.c b/arch/arm64/kernel/acpi_parking_protocol.c index 4b1e5a7..dd671ef 100644 --- a/arch/arm64/kernel/acpi_parking_protocol.c +++ b/arch/arm64/kernel/acpi_parking_protocol.c @@ -21,7 +21,14 @@ #include +struct parking_protocol_mailbox { + __le32 cpu_id; + __le32 reserved; + __le64 entry_point; +}; + struct cpu_mailbox_entry { + struct parking_protocol_mailbox __iomem *mailbox; phys_addr_t mailbox_addr; u8 version; u8 gic_cpu_id; @@ -59,12 +66,6 @@ static int acpi_parking_protocol_cpu_prepare(unsigned int cpu) return 0; } -struct parking_protocol_mailbox { - __le32 cpu_id; - __le32 reserved; - __le64 entry_point; -}; - static int acpi_parking_protocol_cpu_boot(unsigned int cpu) { struct cpu_mailbox_entry *cpu_entry = &cpu_mailbox_entries[cpu]; @@ -97,6 +98,12 @@ static int acpi_parking_protocol_cpu_boot(unsigned int cpu) } /* + * stash the mailbox address mapping to use it for further checks + * in postboot method + */ + cpu_entry->mailbox = mailbox; + + /* * We write the entry point and cpu id as LE regardless of the * native endianness of the kernel. Therefore, any boot-loaders * that read this address need to convert this address to the @@ -107,8 +114,6 @@ static int acpi_parking_protocol_cpu_boot(unsigned int cpu) arch_send_wakeup_ipi_mask(cpumask_of(cpu)); - iounmap(mailbox); - return 0; } @@ -116,32 +121,15 @@ static void acpi_parking_protocol_cpu_postboot(void) { int cpu = smp_processor_id(); struct cpu_mailbox_entry *cpu_entry = &cpu_mailbox_entries[cpu]; - struct parking_protocol_mailbox __iomem *mailbox; + struct parking_protocol_mailbox __iomem *mailbox = cpu_entry->mailbox; __le64 entry_point; - /* - * Map mailbox memory with attribute device nGnRE (ie ioremap - - * this deviates from the parking protocol specifications since - * the mailboxes are required to be mapped nGnRnE; the attribute - * discrepancy is harmless insofar as the protocol specification - * is concerned). - * If the mailbox is mistakenly allocated in the linear mapping - * by FW ioremap will fail since the mapping will be prevented - * by the kernel (it clashes with the linear mapping attributes - * specifications). - */ - mailbox = ioremap(cpu_entry->mailbox_addr, sizeof(*mailbox)); - if (!mailbox) - return; - entry_point = readl_relaxed(&mailbox->entry_point); /* * Check if firmware has cleared the entry_point as expected * by the protocol specification. */ WARN_ON(entry_point); - - iounmap(mailbox); } const struct cpu_operations acpi_parking_protocol_ops = {