Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp3006524pxb; Mon, 6 Sep 2021 10:07:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxO0/9FSTcGU+eyOkiMZGpe2XOLOluWjsgMXfXvnNNV2IhWtANocoRu1z0R/kSf+vuS3Uv8 X-Received: by 2002:a17:906:318c:: with SMTP id 12mr14762788ejy.28.1630948030642; Mon, 06 Sep 2021 10:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630948030; cv=none; d=google.com; s=arc-20160816; b=Q5LWvJ0Ogl/dw4pSFjskDy4BodjItOtFm6Ug1mBZ6IJ5zSag5yNihdEN5+gXvOc/4w ZuDOBX+T16WB1e3yEGAKe8QsEPpaKzI6HU0KZeQ5WKX1DBqX6j47z9NvNcf+UmiLCoKi 97NDgF2pcMYt6OWOQ2/qIGW0POZu4WXXAsjjX0Jww4dgXCq4OaH4/fhJAtaMWfXX/CGL Fi75E7HaeABV/EWbihlOap64fgDgUm20ek1iT97mF1EiICBGosWc73CrpZoQvuEQ4Vtj 6VUTrS38p4ETuVKgw1ylB44KKxqz8uuNwg1lKRD8S/F5/oNVYh1orL4k+r0WkhyEMCvE o8mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:user-agent:date:message-id:subject:from:cc:to :dkim-signature; bh=AmCdNApGszIldNsIIkEGWv5ioCQhcJfxkbQ+XX/90J8=; b=CWLpTRHu4Hj6Nc4f8SmpOSUtHd6gGoRQ2mU1Y+UCpofX/zgftvA15GTvOWvZ27iusF t0lwkhsJ+a4CF/RADx2xAmJ4G+914RyA51KOoxsC/bptVnDMSPgFxJNntCiXQM69FTvh 2SgoSNwuzeGVEKtz8auhVjfXKVT2CIenVZjBrLBPgNEGyfNN/Qr81Volmdj72k7JzInH nHei3da0UbafiFzO38RiZn8VlbmpRmM0D6zpxZjcNJOCIfa0SFKzhRhXA3M+WaoJhV22 r/5uYr374i3iHQRFUXCrBWKtHj160tKqHF1fOLF99bWYFzR/a5A3W0rbiDM7F2Guv6HY hhQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=gEHZA09u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jr12si9256790ejb.335.2021.09.06.10.06.46; Mon, 06 Sep 2021 10:07:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=gEHZA09u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242978AbhIFPx3 (ORCPT + 99 others); Mon, 6 Sep 2021 11:53:29 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:49036 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231359AbhIFPx2 (ORCPT ); Mon, 6 Sep 2021 11:53:28 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 186FqLZ1103762; Mon, 6 Sep 2021 10:52:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1630943541; bh=AmCdNApGszIldNsIIkEGWv5ioCQhcJfxkbQ+XX/90J8=; h=To:CC:From:Subject:Date; b=gEHZA09u1yS7gjKMRjfKR4gxmjxHn3NzsT3Kv8rTM7EH60w8rYtOlpeFxXwHAdKW/ qGH5tGHEqecYJIGiADdE58zSsJG/8jYmWlerPBIiMCFffV6W0sCMkwHHQ7mV5ADbZr 6xID1HvP01opju7vBdBMAiFyQTNoJQh7HR3ggVXU= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 186FqLsK061765 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 6 Sep 2021 10:52:21 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 6 Sep 2021 10:52:21 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Mon, 6 Sep 2021 10:52:21 -0500 Received: from [10.250.235.239] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 186FqGiv119307; Mon, 6 Sep 2021 10:52:17 -0500 To: Cornelia Huck , CC: , Ohad Ben-Cohen , Bjorn Andersson , Mathieu Poirier , linux-remoteproc , "linux-kernel@vger.kernel.org" , "Vutla, Lokesh" , Vignesh Raghavendra , "Strashko, Grygorii" From: Kishon Vijay Abraham I Subject: [QUERY] Flushing cache from userspace using VFIO Message-ID: Date: Mon, 6 Sep 2021 21:22:15 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alex, Cornelia, I'm trying to see if I can use VFIO (Versatile Framework for userspace I/O [1]) for communication between two cores within the same SoC. I've tried to put down a picture like below which tries to communicate between ARM64 (running Linux) and CORTEX R5 (running firmware). It uses rpmsg/remoteproc for the control messages and the actual data buffers are directly accessed from the userspace. The location of the data buffers can be informed to the userspace via rpmsg_vfio (which has to be built as a rpmsg endpoint). My question is after the userspace application in ARM64 writes to a buffer in the SYSTEM MEMORY, can it flush it (through a VFIO IOCTL) before handing the buffer to the CORTEX R5. If it's implemented within kernel either we use dma_alloc_coherent() for allocating coherent memory or streaming DMA APIs like dma_map_single()/dma_unmap_single() for flushing/invalidate the cache. Trying to see if that is already supported in VFIO or if not, would it be acceptable to implement it. Please let me know your thoughts. ┌───────────────────────────────────────────────────────────────────────────┐ │ │ │ ┌────────────────────┐ │ │ │ │ │ │ │ ┌──────────────┐ │ │ │ │ │ userspace │ │ Data Buffers │ │ │ │ Application ├───┼──────────────┐ │ │ │ │ │ │ │ │ │ │ └──────▲──┬────┘ │ │ │ │ │ │ │ │ │ │ │ │ │ │ user │ │ ┌─────────────────┐ │ │ │ ──────┼──┼─────── │ │ │ │ │ │ │ │ │ kernel │ │ │ │ │ │ │ ┌─────┴──▼────┐ │ ┌─────────┼────────────┐ │ │ │ │ │ │ │ │ │ │ │ │ Data │ │ │ │ │ rpmsg_vfio │ │ │ ┌──────▼─────────┐ │ │ Buffers │ │ │ │ │ │ │ │ │ Reserved Region◄──┼────┼────────┐ │ │ │ │ └─────▲──┬────┘ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └────────────────┘ │ │ │ │ │ │ │ ┌─────┴──▼────┐ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌──────┴──────┐ │ │ │ │ │ rpmsg │ │ │ SYSTEM MEMORY │ │ │ Application │ │ │ │ │ │ │ │ │ (DDR) │ │ │ Logic │ │ │ │ │ └─────▲──┬────┘ │ └──────────────────────┘ │ └───▲────┬────┘ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌─────┴──▼────┐ │Notify Firmware/Control Message │ ┌───┴────▼────┐ │ │ │ │ │ ├───┼────────────────────────────────┼─► │ │ │ │ │ │ remoteproc │ │Interrupt ARM/Control Message │ │ Firmware │ │ │ │ │ │ ◄───┼────────────────────────────────┼─┤ │ │ │ │ │ └─────────────┘ │ │ └─────────────┘ │ │ │ │ ARM64(Linux) │ │ ARM CORTEX R5 │ │ │ └────────────────────┘ └─────────────────┘ │ │ │ │ SoC │ └───────────────────────────────────────────────────────────────────────────┘ Thank You, Kishon [1] -> https://youtu.be/WFkdTFTOTpA