Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3991657ybl; Mon, 13 Jan 2020 06:10:54 -0800 (PST) X-Google-Smtp-Source: APXvYqzgME+ELYXXJqel1KQkVUMDikNcQZjvg25wTkSPch9U5hFfnLvYJ4o0eNkQQQsNFvytVSrU X-Received: by 2002:a9d:69ce:: with SMTP id v14mr13652710oto.248.1578924654619; Mon, 13 Jan 2020 06:10:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578924654; cv=none; d=google.com; s=arc-20160816; b=y1PWCcwZmSS0M26islWfYq6iZJnmIlSBZMovWL2dzVoUTEQfwc6l/snXWNot+UPkcd UtB94QORb34YVRFqyf6M9uHLd9U6nDmHFPNXCx3SEZwSi4FKR3zgrvI5xyeKm1ClTOrT 7kaJ1ZFBC8TcgMePgWlrVxyfjUooFTzRifuzEYJsrss9KRvICLXsTD0qlMifE23pbWSQ RGxhTp96GHw0AbZHF4tSX+7vu8RHkdBktqjhNXQYx294xic5aPSk7S82s4eiim0tnkGO 2zAEBIMNEWr6ad4OIfPqsVjXGU221EoahbYK99M8OJnMcmdqvyz9Lmss3nFcOZDBBfNu M6FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jn8kO6Zo5FK80mQbvcSVlvwdlwIvCB39JSX6YNLW/M8=; b=KOXeIpQXly6jxKgs+V1agUwLJLnA50APN/VqGM+si2OzjSzeWQlT4V1lnOSo0/uxgX bv3EZLVmehWxnPPdQ/72hyCCE+EPRnhGswyn5zaWR0S3laXmOSAdg0blBJo18Hvl6fo+ zkUa1LNAW+aEL2yBU3qxpKSSklONQO34cugLbEMFIJj0izQZvmVVUaZeI+ptTByzU/RI KQ2ehohQ1rcFw6q9qEjnY13huJiFj54n9hekwxmXNKLuttwERuEMlhpLh4CRLBOqXnZ9 z3RVu3ZqPD07HrdwzPwhpF80cmkyDMGtuFnyBKu6wACsY9FT55LiMGvXpgRbqZhorFZq vlOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=mail header.b=Isuc29Uk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f4si5780190oij.133.2020.01.13.06.10.37; Mon, 13 Jan 2020 06:10:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=mail header.b=Isuc29Uk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728892AbgAMOIG (ORCPT + 99 others); Mon, 13 Jan 2020 09:08:06 -0500 Received: from forward102o.mail.yandex.net ([37.140.190.182]:44326 "EHLO forward102o.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727331AbgAMOIF (ORCPT ); Mon, 13 Jan 2020 09:08:05 -0500 Received: from mxback10j.mail.yandex.net (mxback10j.mail.yandex.net [IPv6:2a02:6b8:0:1619::113]) by forward102o.mail.yandex.net (Yandex) with ESMTP id EE0DF66816C5; Mon, 13 Jan 2020 17:08:01 +0300 (MSK) Received: from myt2-ea6a2e0cbf34.qloud-c.yandex.net (myt2-ea6a2e0cbf34.qloud-c.yandex.net [2a02:6b8:c00:2e8e:0:640:ea6a:2e0c]) by mxback10j.mail.yandex.net (mxback/Yandex) with ESMTP id BrUeFl0CRC-81tWxxKR; Mon, 13 Jan 2020 17:08:01 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; s=mail; t=1578924481; bh=jn8kO6Zo5FK80mQbvcSVlvwdlwIvCB39JSX6YNLW/M8=; h=In-Reply-To:Subject:To:From:Cc:References:Date:Message-Id; b=Isuc29UkGeRRoYHM7UwmOyn9olVu70/NRKpLrAfixWNnLSZs4cPF3qYqfedEhrb1t osHjgu1J6aBq5eXqBAw7EwJZKf4/6LzCL/w5yj+DFx+c4d+ooBc7vEhhDe3ux1o9WN GJfOHtQ0kOJm68HBcAkNq8QaExrZpgL5EdxmGrFA= Authentication-Results: mxback10j.mail.yandex.net; dkim=pass header.i=@flygoat.com Received: by myt2-ea6a2e0cbf34.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id pGFN2nLtP9-7oV4cj99; Mon, 13 Jan 2020 17:07:59 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: chenhc@lemote.com, paul.burton@mips.com, linux-kernel@vger.kernel.org, hch@lst.de, Jiaxun Yang Subject: [PATCH 2/2] MIPS: Loongson64: Add dma iocoherency detection support Date: Mon, 13 Jan 2020 22:07:05 +0800 Message-Id: <20200113140705.74605-2-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200113140705.74605-1-jiaxun.yang@flygoat.com> References: <20200113140705.74605-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Set hw_iocoherency according to parameter passed from firmware. Signed-off-by: Jiaxun Yang --- arch/mips/Kconfig | 1 + arch/mips/include/asm/mach-loongson64/boot_param.h | 5 +++-- arch/mips/loongson64/env.c | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index d0b727daddb3..8b0cd692a43f 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -474,6 +474,7 @@ config MACH_LOONGSON64 select CSRC_R4K select CEVT_R4K select CPU_HAS_WB + select DMA_MAYBE_COHERENT select FORCE_PCI select ISA select I8259 diff --git a/arch/mips/include/asm/mach-loongson64/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h index 8c286bedff3e..2da2be40ad81 100644 --- a/arch/mips/include/asm/mach-loongson64/boot_param.h +++ b/arch/mips/include/asm/mach-loongson64/boot_param.h @@ -115,7 +115,8 @@ struct irq_source_routing_table { u64 pci_io_start_addr; u64 pci_io_end_addr; u64 pci_config_addr; - u32 dma_mask_bits; + u16 dma_mask_bits; + u16 dma_noncoherent; } __packed; struct interface_info { @@ -206,7 +207,7 @@ struct loongson_system_configuration { u64 poweroff_addr; u64 suspend_addr; u64 vgabios_addr; - u32 dma_mask_bits; + u16 dma_mask_bits; char ecname[32]; u32 nr_uarts; struct uart_device uarts[MAX_UARTS]; diff --git a/arch/mips/loongson64/env.c b/arch/mips/loongson64/env.c index 0daeb7bcf023..61e3d4874fe9 100644 --- a/arch/mips/loongson64/env.c +++ b/arch/mips/loongson64/env.c @@ -15,6 +15,7 @@ */ #include #include +#include #include #include #include @@ -128,6 +129,9 @@ void __init prom_init_env(void) loongson_sysconf.dma_mask_bits > 64) loongson_sysconf.dma_mask_bits = 32; + hw_coherentio = !eirq_source->dma_noncoherent; + pr_info("Firmware I/O coherency: %s\n", hw_coherentio?"ON":"OFF"); + loongson_sysconf.restart_addr = boot_p->reset_system.ResetWarm; loongson_sysconf.poweroff_addr = boot_p->reset_system.Shutdown; loongson_sysconf.suspend_addr = boot_p->reset_system.DoSuspend; -- 2.24.1