Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2778900pxb; Sun, 24 Jan 2021 20:43:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDo8iGfO8ZSOPniBUnHfOzVjs6tjBhd6mBg9xl6kNC45dGq16LXXVqNXCzBD60TWISDfRc X-Received: by 2002:a50:fd83:: with SMTP id o3mr235629edt.359.1611549795495; Sun, 24 Jan 2021 20:43:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611549795; cv=none; d=google.com; s=arc-20160816; b=cyZlBGklQpTEOKdwZ0l9JeNUkBV4M5YcJRJYq76XxhwC1mdw0M4R8JRrkwZZJ7uMit 4V8DJaPH30MrhTB/a4Jxb5EI6OHv9nOQEiuPeYnJTmHnJmo8s+WKK1Ko9ZgrALBdf9eC uvslW2ylsredW410dFNn6CX/bVju9Drol6hrnlr3fCtEEFaFCaqnEJTdifHuwbGPI9jJ xoDq98O1du2Lfu55Io472bcEzyHrb4suvDWo+TL04toocEB1tMgZ6d7H4M+sogxeFev4 Z1iagYUMSOWQ+22vPdyXBFHx8qRNgvGCJb/Fwu3P3pYdtVDGyqp5vcsTjSNtNc/L0DnF gVZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=AGEA01WUrsw5tQQckX7sRxlPuHe9NPKrK6XYRhoAo6c=; b=OXfZlhufhkGj1CoD8cW6dEX3kheah/MIYg6/VkGyEitMe63OGhbRZmejv8VU7mTTcB qiV4fHEDratbj02bF4UU0rnmLtBh2TeRG0zC2uzNcRHV69N7uTFar/VvTLNIW6Hhv1dP /O/yDdDmdCQsJPOyJ7yvUOidN/QjogLsBwaSI0TDFmPxtra6n4AG2CAvpy+5zQxHd7BI IjOwnt/k8gHytZaWbTA66AXl1VB+UHlL90Tks9O1vxwlDek0aykn29vkbSJp1mlP7wU5 NVeatWEodx69mf3euTZECn7vZ2jpgvwTeKOGSH6fKrPMBLA9MuRzwFoohCqoJH3vF4FM VXfw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si5561436ejk.379.2021.01.24.20.42.52; Sun, 24 Jan 2021 20:43:15 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727139AbhAYEjL (ORCPT + 99 others); Sun, 24 Jan 2021 23:39:11 -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