From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85122C433E6 for ; Mon, 25 Jan 2021 04:39:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4942F22D50 for ; Mon, 25 Jan 2021 04:39:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727143AbhAYEjQ (ORCPT ); Sun, 24 Jan 2021 23:39:16 -0500 Received: from mx2.suse.de ([195.135.220.15]:53212 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727137AbhAYEjG (ORCPT ); Sun, 24 Jan 2021 23:39:06 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id EC1E7AF1E; Mon, 25 Jan 2021 04:38:20 +0000 (UTC) Date: Sun, 24 Jan 2021 20:38:11 -0800 From: Davidlohr Bueso To: shuo.a.liu@intel.com Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Greg Kroah-Hartman , "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Yu Wang , Reinette Chatre , Zhi Wang , Zhenyu Wang Subject: Re: [PATCH v8 09/18] virt: acrn: Introduce I/O request management Message-ID: <20210125043811.4vqtgfuok2dvwvxo@offworld> References: <20210122110122.45800-1-shuo.a.liu@intel.com> <20210122110122.45800-10-shuo.a.liu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20210122110122.45800-10-shuo.a.liu@intel.com> User-Agent: NeoMutt/20201120 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Jan 2021, shuo.a.liu@intel.com wrote: >From: Shuo Liu > >An I/O request of a User VM, which is constructed by the hypervisor, is >distributed by the ACRN Hypervisor Service Module to an I/O client >corresponding to the address range of the I/O request. > >For each User VM, there is a shared 4-KByte memory region used for I/O >requests communication between the hypervisor and Service VM. An I/O >request is a 256-byte structure buffer, which is 'struct >acrn_io_request', that is filled by an I/O handler of the hypervisor >when a trapped I/O access happens in a User VM. ACRN userspace in the >Service VM first allocates a 4-KByte page and passes the GPA (Guest >Physical Address) of the buffer to the hypervisor. The buffer is used as >an array of 16 I/O request slots with each I/O request slot being 256 >bytes. This array is indexed by vCPU ID. > >An I/O client, which is 'struct acrn_ioreq_client', is responsible for >handling User VM I/O requests whose accessed GPA falls in a certain >range. Multiple I/O clients can be associated with each User VM. There >is a special client associated with each User VM, called the default >client, that handles all I/O requests that do not fit into the range of >any other I/O clients. The ACRN userspace acts as the default client for >each User VM. > >The state transitions of a ACRN I/O request are as follows. > > FREE -> PENDING -> PROCESSING -> COMPLETE -> FREE -> ... > >FREE: this I/O request slot is empty >PENDING: a valid I/O request is pending in this slot >PROCESSING: the I/O request is being processed >COMPLETE: the I/O request has been processed > >An I/O request in COMPLETE or FREE state is owned by the hypervisor. HSM >and ACRN userspace are in charge of processing the others. > >The processing flow of I/O requests are listed as following: > >a) The I/O handler of the hypervisor will fill an I/O request with > PENDING state when a trapped I/O access happens in a User VM. >b) The hypervisor makes an upcall, which is a notification interrupt, to > the Service VM. >c) The upcall handler schedules a worker to dispatch I/O requests. >d) The worker looks for the PENDING I/O requests, assigns them to > different registered clients based on the address of the I/O accesses, > updates their state to PROCESSING, and notifies the corresponding > client to handle. >e) The notified client handles the assigned I/O requests. >f) The HSM updates I/O requests states to COMPLETE and notifies the > hypervisor of the completion via hypercalls. > >Signed-off-by: Shuo Liu >Reviewed-by: Zhi Wang >Reviewed-by: Reinette Chatre >Cc: Zhi Wang >Cc: Zhenyu Wang >Cc: Yu Wang >Cc: Reinette Chatre >Cc: Greg Kroah-Hartman >Cc: Davidlohr Bueso Thanks for respinning this with a workqueue. Acked-by: Davidlohr Bueso