Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5880488imd; Wed, 31 Oct 2018 03:38:18 -0700 (PDT) X-Google-Smtp-Source: AJdET5fG/+MPpqfUzDAC1MaE7IKJ2f45d7CBeaXJj+AMes04uvdsyd4e0q9aAXqBQYDRLes2Orlo X-Received: by 2002:a62:6e47:: with SMTP id j68-v6mr2764400pfc.197.1540982298382; Wed, 31 Oct 2018 03:38:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540982298; cv=none; d=google.com; s=arc-20160816; b=dOYEHiViw0N0DAWc86dICMijdm1ZojTnnha7CKnxWzP3HviQnPvpcflboXBqE7zJWE pyrRXt9H38eWe/gxepAGGrpivn/WgX3LPmwWu9hmWTTQyvhqJ1qfUdQ9PXaJDOxyN5/u ++Fj532fiYku+C3hlBliEcMVC7UZ1rcqDGf3kRiiOAP8lX0+RTHnj1slE7SfhvJXOOcy kxBRRe43u/58/hGavITglbGfH+Em7N5vHUpQuUSHYB2dYcTgmMypO/tF+ex2gpOv9c/5 6NFyxIxxCzQfoOXd8GofX994guchjD8onqhKmc34UEuoHRhWOO3HRJ19wuKLRC71hYng +sQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=0o4tSM4B+TyPxzw9J2Edpdym6HD3CU4wtMwdn5zlk54=; b=BhV1oscZkrPBseYG1urHDP/8So7FXOOuQ/HghbhX4E1BV9TYo5oJFbVP6w2qW+ZquN 1V7T+QW+fvFzOq5yEuA/Jlzr053BegRMQD0awWhhhrPzo+niCGZR8MPYefwXSetlSbZ9 gJwLcZvBJS9OuuVZ+e34/MfKdmY/zQCY6uTuI2mg0KnZPT8YJYKhphdxU35QtQndAKa1 GcRlHzOKOHlxD2E9jfjEG0zXuNmgkXpYVoEt+QB755MtNVcYivStmxrK7RGmRgvOywG0 wtoWXdh1wJoshCXKJSDMMRZdWbzv8HQJzFXiAx8Zzq9iyr68TK1aFQcVOCOiPu9NDk7l +8HQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w17-v6si18430774pgk.497.2018.10.31.03.38.03; Wed, 31 Oct 2018 03:38:18 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728482AbeJaTdy (ORCPT + 99 others); Wed, 31 Oct 2018 15:33:54 -0400 Received: from 59-120-53-16.HINET-IP.hinet.net ([59.120.53.16]:20861 "EHLO ATCSQR.andestech.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727980AbeJaTdx (ORCPT ); Wed, 31 Oct 2018 15:33:53 -0400 Received: from mail.andestech.com (atcpcs16.andestech.com [10.0.1.222]) by ATCSQR.andestech.com with ESMTP id w9VAaVRO095819; Wed, 31 Oct 2018 18:36:31 +0800 (GMT-8) (envelope-from vincentc@andestech.com) Received: from atcsqa06.andestech.com (10.0.15.65) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.123.3; Wed, 31 Oct 2018 18:35:35 +0800 From: Vincent Chen To: , CC: , , , , , , , Subject: [RFC 0/2] RISC-V: A proposal to add vendor-specific code Date: Wed, 31 Oct 2018 18:35:28 +0800 Message-ID: <1540982130-28248-1-git-send-email-vincentc@andestech.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.0.15.65] X-DNSRBL: X-MAIL: ATCSQR.andestech.com w9VAaVRO095819 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org RISC-V permits each vendor to develop respective extension ISA based on RISC-V standard ISA. This means that these vendor-specific features may be compatible to their compiler and CPU. Therefore, each vendor may be considered a sub-architecture of RISC-V. Currently, vendors do not have the appropriate examples to add these specific features to the kernel. In this RFC set, we propose an infrastructure that vendor can easily hook their specific features into kernel. The first commit is the main body of this infrastructure. In the second commit, we provide a solution that allows dma_map_ops() to work without cache coherent agent support. Cache coherent agent is unsupported for low-end CPUs in the AndeStar RISC-V series. In order for Linux to run on these CPUs, we need this solution to overcome the limitation of cache coherent agent support. Hence, it also can be used as an example for the first commit. I am glad to discuss any ideas, so if you have any idea, please give me some feedback. Vincent Chen (2): RISC-V: An infrastructure to add vendor-specific code. RISC-V: make dma_map_ops work without cache coherent agent arch/riscv/Kconfig | 49 +++++ arch/riscv/Makefile | 6 + arch/riscv/include/asm/sbi.h | 6 + arch/riscv/include/asm/vendor-hook.h | 13 ++ arch/riscv/kernel/cpufeature.c | 5 + arch/riscv/kernel/setup.c | 6 +- arch/riscv/vendor-nds/Kconfig | 29 +++ arch/riscv/vendor-nds/Makefile | 1 + arch/riscv/vendor-nds/cache.c | 83 ++++++++ arch/riscv/vendor-nds/include/asm/csr.h | 32 +++ arch/riscv/vendor-nds/include/asm/dma-mapping.h | 24 +++ arch/riscv/vendor-nds/include/asm/proc.h | 17 ++ arch/riscv/vendor-nds/include/asm/sbi.h | 17 ++ arch/riscv/vendor-nds/include/asm/vendor-hook.h | 8 + arch/riscv/vendor-nds/noncoherent_dma.c | 254 +++++++++++++++++++++++ arch/riscv/vendor-nds/setup.c | 16 ++ 16 files changed, 565 insertions(+), 1 deletions(-) create mode 100644 arch/riscv/include/asm/vendor-hook.h create mode 100644 arch/riscv/vendor-nds/Kconfig create mode 100644 arch/riscv/vendor-nds/Makefile create mode 100644 arch/riscv/vendor-nds/cache.c create mode 100644 arch/riscv/vendor-nds/include/asm/csr.h create mode 100644 arch/riscv/vendor-nds/include/asm/dma-mapping.h create mode 100644 arch/riscv/vendor-nds/include/asm/proc.h create mode 100644 arch/riscv/vendor-nds/include/asm/sbi.h create mode 100644 arch/riscv/vendor-nds/include/asm/vendor-hook.h create mode 100644 arch/riscv/vendor-nds/noncoherent_dma.c create mode 100644 arch/riscv/vendor-nds/setup.c