All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Shuo A Liu <shuo.a.liu@intel.com>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"H . Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Yu Wang <yu1.wang@intel.com>,
	Reinette Chatre <reinette.chatre@intel.com>,
	Zhi Wang <zhi.a.wang@intel.com>, Borislav Petkov <bp@suse.de>,
	Dave Hansen <dave.hansen@intel.com>,
	Sen Christopherson <sean.j.christopherson@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Fengwei Yin <fengwei.yin@intel.com>,
	Zhenyu Wang <zhenyuw@linux.intel.com>
Subject: Re: [PATCH v7 01/18] docs: acrn: Introduce ACRN
Date: Tue, 19 Jan 2021 09:36:15 +0800	[thread overview]
Message-ID: <20210119013615.GG22447@shuo-intel.sh.intel.com> (raw)
In-Reply-To: <33ff89ab-db2d-ed9c-3632-014870a1c238@infradead.org>

Hi Randy,

Thanks for review.

On Mon 18.Jan'21 at 14:30:51 -0800, Randy Dunlap wrote:
>On 1/5/21 11:50 PM, shuo.a.liu@intel.com wrote:
>> From: Shuo Liu <shuo.a.liu@intel.com>
>>
>> Add documentation on the following aspects of ACRN:
>>
>>   1) A brief introduction on the architecture of ACRN.
>>   2) I/O request handling in ACRN.
>>   3) CPUID functions of ACRN.
>>
>> To learn more about ACRN, please go to ACRN project website
>> https://projectacrn.org, or the documentation page
>> https://projectacrn.github.io/.
>>
>> Signed-off-by: Shuo Liu <shuo.a.liu@intel.com>
>> Reviewed-by: Zhi Wang <zhi.a.wang@intel.com>
>> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
>> Reviewed-by: Borislav Petkov <bp@suse.de>
>> Cc: Dave Hansen <dave.hansen@intel.com>
>> Cc: Sen Christopherson <sean.j.christopherson@intel.com>
>> Cc: Dan Williams <dan.j.williams@intel.com>
>> Cc: Fengwei Yin <fengwei.yin@intel.com>
>> Cc: Zhi Wang <zhi.a.wang@intel.com>
>> Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
>> Cc: Yu Wang <yu1.wang@intel.com>
>> Cc: Reinette Chatre <reinette.chatre@intel.com>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> Cc: Randy Dunlap <rdunlap@infradead.org>
>> ---
>>  Documentation/virt/acrn/cpuid.rst        | 46 +++++++++++
>>  Documentation/virt/acrn/index.rst        | 12 +++
>>  Documentation/virt/acrn/introduction.rst | 43 +++++++++++
>>  Documentation/virt/acrn/io-request.rst   | 97 ++++++++++++++++++++++++
>>  Documentation/virt/index.rst             |  1 +
>>  MAINTAINERS                              |  7 ++
>>  6 files changed, 206 insertions(+)
>>  create mode 100644 Documentation/virt/acrn/cpuid.rst
>>  create mode 100644 Documentation/virt/acrn/index.rst
>>  create mode 100644 Documentation/virt/acrn/introduction.rst
>>  create mode 100644 Documentation/virt/acrn/io-request.rst
>>
>> diff --git a/Documentation/virt/acrn/cpuid.rst b/Documentation/virt/acrn/cpuid.rst
>> new file mode 100644
>> index 000000000000..16727fc412f0
>> --- /dev/null
>> +++ b/Documentation/virt/acrn/cpuid.rst
>> @@ -0,0 +1,46 @@
>> +.. SPDX-License-Identifier: GPL-2.0
>> +
>> +===============
>> +ACRN CPUID bits
>> +===============
>> +
>> +A guest VM running on an ACRN hypervisor, can check some of its features using
>
>comma not needed/not wanted.

Removed.

>
>> +CPUID.
>> +
>> +ACRN cpuid functions are:
>> +
>> +function: 0x40000000
>> +
>> +returns::
>> +
>> +   eax = 0x40000010
>> +   ebx = 0x4e524341
>> +   ecx = 0x4e524341
>> +   edx = 0x4e524341
>> +
>> +Note that this value in ebx, ecx and edx corresponds to the string
>> +"ACRNACRNACRN". The value in eax corresponds to the maximum cpuid function
>> +present in this leaf, and will be updated if more functions are added in the
>
>except for the 0x4000000 bit?

It's the maximum cpuid function value. So it's 0x40000010.

>
>> +future.
>> +
>> +function: define ACRN_CPUID_FEATURES (0x40000001)
>> +
>> +returns::
>> +
>> +          ebx, ecx, edx
>> +          eax = an OR'ed group of (1 << flag)
>> +
>> +where ``flag`` is defined as below:
>> +
>> +================================= =========== ================================
>> +flag                              value       meaning
>> +================================= =========== ================================
>> +ACRN_FEATURE_PRIVILEGED_VM        0           guest VM is a privileged VM
>> +================================= =========== ================================
>> +
>> +function: 0x40000010
>> +
>> +returns::
>> +
>> +          ebx, ecx, edx
>> +          eax = (Virtual) TSC frequency in kHz.
>> diff --git a/Documentation/virt/acrn/index.rst b/Documentation/virt/acrn/index.rst
>> new file mode 100644
>> index 000000000000..b5f793e73df5
>> --- /dev/null
>> +++ b/Documentation/virt/acrn/index.rst
>> @@ -0,0 +1,12 @@
>> +.. SPDX-License-Identifier: GPL-2.0
>> +
>> +===============
>> +ACRN Hypervisor
>> +===============
>> +
>> +.. toctree::
>> +   :maxdepth: 1
>> +
>> +   introduction
>> +   io-request
>> +   cpuid
>> diff --git a/Documentation/virt/acrn/introduction.rst b/Documentation/virt/acrn/introduction.rst
>> new file mode 100644
>> index 000000000000..f8d081bc084d
>> --- /dev/null
>> +++ b/Documentation/virt/acrn/introduction.rst
>> @@ -0,0 +1,43 @@
>> +.. SPDX-License-Identifier: GPL-2.0
>> +
>> +ACRN Hypervisor Introduction
>> +============================
>> +
>> +The ACRN Hypervisor is a Type 1 hypervisor, running directly on bare-metal
>> +hardware. It has a privileged management VM, called Service VM, to manage User
>> +VMs and do I/O emulation.
>> +
>> +ACRN userspace is an application running in the Service VM that emulates
>> +devices for a User VM based on command line configurations. ACRN Hypervisor
>> +Service Module (HSM) is a kernel module in the Service VM which provides
>> +hypervisor services to the ACRN userspace.
>> +
>> +Below figure shows the architecture.
>> +
>> +::
>> +
>> +                Service VM                    User VM
>> +      +----------------------------+  |  +------------------+
>> +      |        +--------------+    |  |  |                  |
>> +      |        |ACRN userspace|    |  |  |                  |
>> +      |        +--------------+    |  |  |                  |
>> +      |-----------------ioctl------|  |  |                  |   ...
>> +      |kernel space   +----------+ |  |  |                  |
>> +      |               |   HSM    | |  |  | Drivers          |
>> +      |               +----------+ |  |  |                  |
>> +      +--------------------|-------+  |  +------------------+
>> +  +---------------------hypercall----------------------------------------+
>> +  |                         ACRN Hypervisor                              |
>> +  +----------------------------------------------------------------------+
>> +  |                          Hardware                                    |
>> +  +----------------------------------------------------------------------+
>> +
>> +ACRN userspace allocates memory for the User VM, configures and initializes the
>> +devices used by the User VM, loads the virtual bootloader, initializes the
>> +virtual CPU state and handles I/O request accesses from the User VM. It uses
>> +ioctls to communicate with the HSM. HSM implements hypervisor services by
>> +interacting with the ACRN Hypervisor via hypercalls. HSM exports a char device
>> +interface (/dev/acrn_hsm) to userspace.
>> +
>> +The ACRN hypervisor is open for contribution from anyone. The source repo is
>> +available at https://github.com/projectacrn/acrn-hypervisor.
>> diff --git a/Documentation/virt/acrn/io-request.rst b/Documentation/virt/acrn/io-request.rst
>> new file mode 100644
>> index 000000000000..79022a671ea7
>> --- /dev/null
>> +++ b/Documentation/virt/acrn/io-request.rst
>> @@ -0,0 +1,97 @@
>> +.. SPDX-License-Identifier: GPL-2.0
>> +
>> +I/O request handling
>> +====================
>> +
>> +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. Details of I/O request
>> +handling are described in the following sections.
>> +
>> +1. 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.
>> +
>> +2. I/O clients
>> +--------------
>> +
>> +An I/O 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 clients. The ACRN userspace acts as the default client for each User
>> +VM.
>> +
>> +Below illustration shows the relationship between I/O requests shared buffer,
>> +I/O requests and I/O clients.
>> +
>> +::
>> +
>> +     +------------------------------------------------------+
>> +     |                                       Service VM     |
>> +     |+--------------------------------------------------+  |
>> +     ||      +----------------------------------------+  |  |
>> +     ||      | shared page            ACRN userspace  |  |  |
>> +     ||      |    +-----------------+  +------------+ |  |  |
>> +     ||   +----+->| acrn_io_request |<-+  default   | |  |  |
>> +     ||   |  | |  +-----------------+  | I/O client | |  |  |
>> +     ||   |  | |  |       ...       |  +------------+ |  |  |
>> +     ||   |  | |  +-----------------+                 |  |  |
>> +     ||   |  +-|--------------------------------------+  |  |
>> +     ||---|----|-----------------------------------------|  |
>> +     ||   |    |                             kernel      |  |
>> +     ||   |    |            +----------------------+     |  |
>> +     ||   |    |            | +-------------+  HSM |     |  |
>> +     ||   |    +--------------+             |      |     |  |
>> +     ||   |                 | | I/O clients |      |     |  |
>> +     ||   |                 | |             |      |     |  |
>> +     ||   |                 | +-------------+      |     |  |
>> +     ||   |                 +----------------------+     |  |
>> +     |+---|----------------------------------------------+  |
>> +     +----|-------------------------------------------------+
>> +          |
>> +     +----|-------------------------------------------------+
>> +     |  +-+-----------+                                     |
>> +     |  | I/O handler |              ACRN Hypervisor        |
>> +     |  +-------------+                                     |
>> +     +------------------------------------------------------+
>> +
>> +3. I/O request state transition
>> +-------------------------------
>> +
>> +The state transitions of an 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.
>> +
>> +4. Processing flow of I/O requests
>> +-------------------------------
>
>add 3 more '-' above, please.

Sure. Thanks.

shuo

  reply	other threads:[~2021-01-19  1:37 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06  7:50 [PATCH v7 00/18] HSM driver for ACRN hypervisor shuo.a.liu
2021-01-06  7:50 ` [PATCH v7 01/18] docs: acrn: Introduce ACRN shuo.a.liu
2021-01-18 22:30   ` Randy Dunlap
2021-01-19  1:36     ` Shuo A Liu [this message]
2021-01-06  7:50 ` [PATCH v7 02/18] x86/acrn: Introduce acrn_{setup, remove}_intr_handler() shuo.a.liu
2021-01-06  7:50 ` [PATCH v7 03/18] x86/acrn: Introduce acrn_cpuid_base() and hypervisor feature bits shuo.a.liu
2021-01-06  7:50 ` [PATCH v7 04/18] x86/acrn: Introduce hypercall interfaces shuo.a.liu
2021-01-06  7:50 ` [PATCH v7 05/18] virt: acrn: Introduce ACRN HSM basic driver shuo.a.liu
2021-01-06  7:50 ` [PATCH v7 06/18] virt: acrn: Introduce VM management interfaces shuo.a.liu
2021-01-08 15:31   ` Greg Kroah-Hartman
2021-01-11  3:55     ` Shuo A Liu
2021-01-06  7:50 ` [PATCH v7 07/18] virt: acrn: Introduce an ioctl to set vCPU registers state shuo.a.liu
2021-01-08 15:33   ` Greg Kroah-Hartman
2021-01-11  3:59     ` Shuo A Liu
2021-01-06  7:50 ` [PATCH v7 08/18] virt: acrn: Introduce EPT mapping management shuo.a.liu
2021-01-08 15:34   ` Greg Kroah-Hartman
2021-01-11  4:03     ` Shuo A Liu
2021-01-06  7:50 ` [PATCH v7 09/18] virt: acrn: Introduce I/O request management shuo.a.liu
2021-01-11 21:52   ` Davidlohr Bueso
2021-01-12  6:05     ` Shuo A Liu
2021-01-12 17:29       ` Davidlohr Bueso
2021-01-06  7:50 ` [PATCH v7 10/18] virt: acrn: Introduce PCI configuration space PIO accesses combiner shuo.a.liu
2021-01-06  7:50 ` [PATCH v7 11/18] virt: acrn: Introduce interfaces for PCI device passthrough shuo.a.liu
2021-01-06  7:50 ` [PATCH v7 12/18] virt: acrn: Introduce interrupt injection interfaces shuo.a.liu
2021-01-06  7:50 ` [PATCH v7 13/18] virt: acrn: Introduce interfaces to query C-states and P-states allowed by hypervisor shuo.a.liu
2021-01-06  7:50 ` [PATCH v7 14/18] virt: acrn: Introduce I/O ranges operation interfaces shuo.a.liu
2021-01-06  7:50 ` [PATCH v7 15/18] virt: acrn: Introduce ioeventfd shuo.a.liu
2021-01-06  7:50 ` [PATCH v7 16/18] virt: acrn: Introduce irqfd shuo.a.liu
2021-01-06  7:50 ` [PATCH v7 17/18] virt: acrn: Introduce an interface for Service VM to control vCPU shuo.a.liu
2021-01-06  7:50 ` [PATCH v7 18/18] sample/acrn: Introduce a sample of HSM ioctl interface usage shuo.a.liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210119013615.GG22447@shuo-intel.sh.intel.com \
    --to=shuo.a.liu@intel.com \
    --cc=bp@alien8.de \
    --cc=bp@suse.de \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=fengwei.yin@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=reinette.chatre@intel.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yu1.wang@intel.com \
    --cc=zhenyuw@linux.intel.com \
    --cc=zhi.a.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.