Commit Graph

5897 Commits

Author SHA1 Message Date
Yang,Yu-chu 3c86de8fb9 acrn-config: insert legacy vuart0 base by its enablement status
The legacy vuart0 of any VMs inserts its base address declaration
anyway without checking whether it's disabled or enabled, and the
com base is hardcoded no matter what is specified in xmls.

Pull the legacy vuart enablement status based on scenario xml.

This reverts commit a8fe9b906a

Tracked-On: #5470
Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
2020-11-09 08:53:36 +08:00
Peter Fang 5a13237b1f hv: remove vm_lock in hcall_destroy_vm()
Hypercall handlers for post-launched VMs automatically grab the vm_lock
in dispatch_sos_hypercall(). Remove the use of vm_lock inside the
handler.

Tracked-On: #5411
Signed-off-by: Peter Fang <peter.fang@intel.com>
2020-11-06 15:11:15 +08:00
Tomas Winkler 188ab4f85b dm: virtio: check for paddr_guest2host return value
paddr_guest2host can return NULL, but code paths in virtio
are not checking the return value.
_vq_record() initializes iov_base pointer using paddr_guest2host()
but there is nothing in the flow that checks for NULL.
Chane _vq_record to return -1 in case the address translation
has failed.

Tracked-On: #5452
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2020-11-06 15:08:30 +08:00
David B. Kinder a2167ae93a doc: add extension to create files and raw links
Links to files in the GitHub repo's master branch should be to the files
within the branch being generated.  For example, in the v2.1
documentation, links should be to the v2.1 branch contents.  (Previously
links were being made to the master branch in all our archived content.)
This creates a problem when we want to remove an obsolete file in the
master branch but can't because older documentaiton incorrectly depends
on it.

This new extension defines a :acrn_file: and :acrn_raw: role that will
create links to the given file within the current commit branch.

This PR also replaces docs with hard-coded links to files in the master
branch with uses of these new roles to create links to files.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-11-05 09:17:05 -08:00
David B. Kinder 6b45fc5517 doc: add sphinx-generated index to leftnav
Sphinx generates a full-site index (headings, terms, function names,
etc.) but we haven't been linking to it.  This is a tricky way to get
the site index added to the left nav that appears to work, by creating a
genindex.rst that we can link to in the site toctree so it shows up in
the leftnav, but the generated genindex.html for the dummy genindex.rst
will be overwritten by the sphinx created genindex.html with the
full-site index.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-11-05 09:16:45 -08:00
Sun Peng 73f21a41ad DM: gvt: Identical mapping for GPU DSM
Windows graphic driver obtains DSM address from in-BAR mmio register
which has passthroughed. Not like the other platforms obtained from
pci configure space register which has virtualized. So TGL has to
keep identical mapping to avoid trap mmio BAR to do the emulation.

To keep simple, this patch hardcode the TGL DSM region in vE820
table, this will cause memory waste here. In the near future, we
need refine the entire vE820 logic as it is hard to maintained
due to many reserved regions have introduced in recently.

Signed-off-by: Sun Peng <peng.p.sun@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
Tracked-On: #5461
2020-11-04 11:24:49 +08:00
Yang,Yu-chu b02776a9d4 acrn-config: removed_nested returns None instead return Error
qemu xml has no devices list. Tool will receive the empty devices
list while parsing the "platform" xml. Remove the error of resolved
nested mmio address window that the input couldn't be None. Simply
return an None list.

Tracked-On:#5454
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
2020-11-04 10:38:40 +08:00
Liu Long 853a50a2da ACRN:DM:xHCI Fix the unsigned integer conversion bug
When libusb_control_transfer function return a negative number, because
 the function clear_uas_desc's argument is unsigned int this will cause
 unsigned integer conversion.

Tracked-On: #5463
Signed-off-by: Liu Long <long.liu@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2020-11-04 10:35:38 +08:00
Shuang Zheng 0cd71f2cf2 acrn-config: remove PSRAM_PASSTHROUGH_PRE_RTVM and disable PSRAM config
remove PSRAM_PASSTHROUGH_PRE_RTVM config which is not used in
PSRAM config and disable psram config.

Tracked-On: #5418

Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Reviewed-by: Victor Sun <victor.sun@intel.com>
2020-11-04 10:34:59 +08:00
dongshen ca5683f78d hv: add support for shutdown for pre-launched VMs
Currently, ACRN only support shutdown when triple fault happens, because ACRN
doesn't present/emulate a virtual HW, i.e. port IO, to support shutdown. This
patch emulate a virtual shutdown component, and the vACPI method for guest OS
to use.

Pre-launched VM uses ACPI reduced HW mode, intercept the virtual sleep control/status
registers for pre-launched VMs shutdown

Tracked-On: #5411
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2020-11-04 10:33:31 +08:00
dongshen 8f79ceefbd hv: fix out-of-date comments related to pre-launched VMs rebooting
Like post-launched VMs, for pre-launched VMs, the ACPI reset register
is also fixed at 0xcf9 and the reset value is 0xE, so pre-launched VMs
now also use ACPI reset register for rebooting.

Tracked-On: #5411
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2020-11-04 10:33:31 +08:00
dongshen 9735718e1f acrn-config: specify kernel boot argument 'reboot=acpi' for pre-launched VMs
Add the 'reboot=acpi' kernel boot argument for pre-launched VMs

Add the code to sanity check if 'reboot=acpi' is specified in the
scenario files

If hardware reduced ACPI is detected, by default, Linux will set the reboot type to
use EFI for rebooting. "reboot=acpi" sets the reboot type to use ACPI for rebooting.

Tracked-On: #5411
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2020-11-04 10:33:31 +08:00
dongshen 7cc9c8fe06 acrn-config: build a hardware-reduced only ACPI
Change ACPI version from V3 to V5 to support hardware-reduced ACPI, which
is a V5 feature

Remove/obsolete the PM1X related stuff as they are not used for hardware-reduced
ACPI

Add the _S5 method in DSDT table

Using hardware-reduced mode allows to use a much simpler form of ACPI that
does not require supporting the legacy of previous versions of the specification
such as SCI IRQ.

Hardware-reduced mode is specified by setting the Hardware Reduced (HW_REDUCED_ACPI)
flag in FADT table.

If the HW_REDUCED_ACPI flag in the FADT table is set, OSPM will ignore fields related
to the ACPI HW register interface such as the PM1x control register. Instead, sleep
control/status registers can be used for system sleep state entry on hardware-reduced
ACPI systems.

Tracked-On: #5411
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2020-11-04 10:33:31 +08:00
dongshen 3cf476dc1d acrn-config: specify valid ACPI reset register address and value in FADT table
So that guest VM can recognize and use ACPI reset register to reboot

No need to specify "Flags (decoded below)" in FADT template, iasl will
calculate and fill in this flag for us

Tracked-On: #5411
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2020-11-04 10:33:31 +08:00
Peter Fang e5edc7c090 hv: console: switch back to HV shell on VM pause
A VM may transition to VM_PAUSED state while its console is being used.

Jump back to the HV shell if this happens so the console does not appear
stuck.

Tracked-On: #5411
Signed-off-by: Peter Fang <peter.fang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-11-04 10:33:31 +08:00
Peter Fang 70b1218952 hv: pm: support shutting down multiple VMs when pCPUs are shared
More than one VM may request shutdown on the same pCPU before
shutdown_vm_from_idle() is called in the idle thread when pCPUs are
shared among VMs.

Use a per-pCPU bitmap to store all the VMIDs requesting shutdown.

v1 -> v2:
- use vm_lock to avoid a race on shutdown

Tracked-On: #5411
Signed-off-by: Peter Fang <peter.fang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-11-04 10:33:31 +08:00
David B. Kinder 63fd853df3 doc: improve GSG navigation
Feedback suggests we add more top-level navigation to the getting
started guides, so let's include a local TOC as well as using the
"numbered-step" style to top-level steps.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-11-03 15:14:32 -08:00
fuzhongl c94d628907 Doc: Update Debian as Service Vm
Update steps from de-privileged boot to direct boot.

Signed-off-by: fuzhongl <fuzhong.liu@intel.com>
2020-11-03 10:20:03 -08:00
David B. Kinder 9292e57786 doc: bring back prev/next buttons
Some ACRN docs (in particular the HLD) has content nested more than the
4 levels shown in the sidebar navigation.  So when looking at those
documents, it's hard to get to next chapter.  Bring back the
previous/next links to fix this situation.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-11-03 09:07:41 -08:00
Li Fei1 c6f9404f55 hv: psram: add kconfig to enable psram
Add two Kconfig pSRAM config:
one for whether to enable the pSRAM on the platfrom or not;
another for if the pSRAM is enabled on the platform whether to enable
the pSRAM in the pre-launched RTVM.
If we enable the pSRAM on the platform, we should remove the pSRAM EPT
mapping from the SOS to prevent it could flush the pSRAM cache.

Tracked-On: #5330
Signed-off-by: Qian Wang <qian1.wang@intel.com>
2020-11-02 15:56:30 +08:00
Qian Wang 99ee76781f hv: pSRAM: add pSRAM support for pre-launched RTVM
1.Modified the virtual e820 table for pre-launched VM. We added a
segment for pSRAM, and thus lowmem RAM is split into two parts.
Logics are added to deal with the split.
2.Added EPT mapping of pSRAM segment for pre-launched RTVM if it
uses pSRAM.

Tracked-On: #5330
Signed-off-by: Qian Wang <qian1.wang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-11-02 15:56:30 +08:00
Qian Wang 7bd0f7507e DM: add command line parameter for pSRAM
dm: pSRAM: added a command line parameter "--psram" to enable pSRAM
support for post-launched RTVM

Added "--psram" in DM command line to enable pSRAM support for
post-launched RTVM

Tracked-On: #5330
Signed-off-by: Qian Wang <qian1.wang@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2020-11-02 15:56:30 +08:00
Qian Wang a557105e71 hv: ept: set EPT cache attribute to WB for pSRAM
pSRAM memory should be cachable. However, it's not a RAM or a normal MMIO,
so we can't use the an exist API to do the EPT mapping and set the EPT cache
attribute to WB for it. Now we assume that SOS must assign the PSRAM area as
a whole and as a separate memory region whose base address is PSRAM_BASE_HPA.
If the hpa of the EPT mapping region is equal to PSRAM_BASE_HPA, we think this
EPT mapping is for pSRAM, we change the EPT mapping cache attribute to WB.

And fix a minor bug when SOS trap out to emulate wbinvd when pSRAM is enabled.

Tracked-On: #5330
Signed-off-by: Qian Wang <qian1.wang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-11-02 15:56:30 +08:00
Qian Wang 46afb946da DM: modify vE820 to adapt to pSRAM
dm: modify vE820 to adapt to pSRAM for post-launched RTVM

When pSRAM is enabled for post-launched RTVM, we add a segment in vE820 for
pSRAM, and therefore the lowmem RAM will be split into part1 and part2.
Also, code of post vE820 initialization is refined

Tracked-On: #5330
Signed-off-by: Qian Wang <qian1.wang@intel.com>
2020-11-02 15:56:30 +08:00
Qian Wang 2fdd1374a9 DM: add vPTCT for post-launched RTVM
dm: vptct: add vPTCT for post-launched RTVM

We added vPTCT support for post-launched RTVM:
1. Added a function create_and_inject_vptct. Currently, we
pass-through the whole pSRAM to one RTVM, so we will also pass-
through the PTCT to the very same RTVM. This function will
read the native PTCT from SOS and inject it into post-
launched VM's vACPI.
2. Added some definitions for vPTCT.

Tracked-On: #5330
Signed-off-by: Qian Wang <qian1.wang@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2020-11-02 15:56:30 +08:00
Qian Wang ca2aee225c hv: skip pSRAM for guest WBINVD emulation
Use ept_flush_leaf_page to emulate guest WBINVD when PTCM is enabled and skip
the pSRAM in ept_flush_leaf_page.
TODO: do we need to emulate WBINVD in HV side.

Tracked-On: #5330
Signed-off-by: Qian Wang <qian1.wang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-11-02 10:29:43 +08:00
Li Fei1 f3067f5385 hv: mmu: rename hv_access_memory_region_update to ppt_clear_user_bit
Rename hv_access_memory_region_update to ppt_clear_user_bit to
verb + object style.

Tracked-On: #5330
Signed-off-by: Li Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-11-02 10:29:43 +08:00
Li Fei1 35abee60d6 hv: pSRAM: temporarily remove NX bit of PTCM binary
Temporarily remove NX bit of PTCM binary in pagetable during pSRAM
initialization:
1.added a function ppt_set_nx_bit to temporarily remove/restore the NX bit of
a given area in pagetable.
2.Temporarily remove NX bit of PTCM binary during pSRAM initialization to make
PTCM codes executable.
3. TODO: We may use SMP call to flush TLB and do pSRAM initilization on APs.

Tracked-On: #5330
Signed-off-by: Qian Wang <qian1.wang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-11-02 10:29:43 +08:00
Li Fei1 5fa816f921 hv: pSRAM: add PTCT parsing code
The added parse_ptct function will parse native ACPI PTCT table to
acquire information like pSRAM location/size/level and PTCM location,
and save them.

Tracked-On: #5330
Signed-off-by: Qian Wang <qian1.wang@intel.com>
2020-11-02 10:29:43 +08:00
Li Fei1 80121b8347 hv: pSRAM: add pSRAM initialization codes
1.We added a function init_psram to initialize pSRAM as well as some definitions.
Both AP and BSP shall call init_psram to make sure pSRAM is initialized, which is
required by PTCM.

BSP:
  To parse PTCT and find the entry of PTCM command function, then call PTCM ABI.
AP:
  Wait until BSP has done the parsing work, then call the PTCM ABI.

Synchronization of AP and BSP is ensured, both inside and outside PTCM.

2. Added calls of init_psram in init_pcpu_post to initialize pSRAM in HV booting phase

Tracked-On: #5330
Signed-off-by: Qian Wang <qian1.wang@intel.com>
2020-11-02 10:29:43 +08:00
Qian Wang 77269c15c5 hv: vcr: remove wbinvd for CR0.CD emulation
According 11.5.1 Cache Control Registers and Bits, Intel SDM Vol 3,
change CR0.CD will not flush cache to insure memory coherency. So
it's not needed to call wbinvd to flush cache in ACRN Hypervisor.
That's what the guest should do.

Tracked-On: #5330
Signed-off-by: Qian Wang <qian1.wang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-11-02 10:29:43 +08:00
Yang,Yu-chu a8fe9b906a acrn-config: remove legacy vuart declaration
Improve the legacy vuart code. The legacy vuart insert the declaration
without checking if it's enabled. Refined the logic that if the legacy
is disabled, simply do not declare.

Tracked-On: #5425
Signed-off-by: Yang,Yu-chu <yu-chu,yang>
2020-11-02 08:52:52 +08:00
Yang, Yu-chu 0d9c2ac6aa acrn-config: remove readonly="0" from legacy_vuart in all scenario xmls
Remove readonly="0" from legacy_vuarts in xml and make it configurable.

Tracked-On: #5425
Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
2020-11-02 08:52:52 +08:00
Yang, Yu-chu 60f9b62826 acrn-config: Add console and communication vuarts to template and
generic

Add console and communication vuarts to:
misc/vm_configs/xmls/config-xmls/generic/<scenario>.xml
misc/vm_configs/xmls/config-xmls/template/<scenario>.xml

Tracked-On: #5425
Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
2020-11-02 08:52:52 +08:00
Yang, Yu-chu 3a53bb9b74 acrn-config: add console and communication vuarts to scenario xmls
Add console and communication vuarts to default xmls under:
misc/vm_configs/xmls/config-xmls/<platforms>/<scenarios>.xml

Tracked-On: #5425
Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
2020-11-02 08:52:52 +08:00
Yang, Yu-chu 1f32bd6542 acrn-config: Add console and communication vuarts to launch xmls
Add new tag console_vuart and communication_vuarts to all launch script
xmls.

Tracked-On: #5425
Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
2020-11-02 08:52:52 +08:00
Yang, Yu-chu 4f79e691d0 acrn-config: pci vuart sanity check for scenario xmls
Check if the scenario xmls configure pci vuarts properly
Sanity check of scenario xml:
1. check the format of console and communication vuarts
2. legacy vuart0 and console vuart0 cannot be eabled at the same time
3. legacy vuart1 and communication vuart1 cannot be enabled at the
same time
4. Any vuart should not connect to any type of vuart0
5. Every vuart can only connect to enabled vuart<idx> (idx > 0)

Tracked-On: #5425
Signed-off-by: Yang,Yu-chu <yu-chu,yang>
2020-11-02 08:52:52 +08:00
Yang, Yu-chu 29fbefea74 acrn-config: add pci vuart to launch script
Add pci vuart to launch script if the pci vuart is enabled.
Add pci vuart sanity check for launch script:
- vuart0 and console vuart cannot be enabled at the same time
- vuart1 cannot be eabled if the legacy vuart 1 is enabled

Tracked-On: #5425
Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
2020-11-02 08:52:52 +08:00
Yang, Yu-chu 6ecd58f51a acrn-config: add pci vuart number to total pci devices number
take enabled pci vuarts to count in total pci devices number per VM

Tracked-On: #5425
Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
2020-11-02 08:52:52 +08:00
Yang, Yu-chu 4f8ec75c8a acrn-config: add legacy vuart parser in common library
- Add legacy vuart in get_leaf_tag_map.
- Rename vuart to legacy vuart in plateform scenario xmls accrodingly

Tracked-On: #5425
Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
2020-11-02 08:52:52 +08:00
Yang, Yu-chu e52b3ce7de acrn-config: rename vuart to legacy vuart in xmls
rename vuart to legacy vuart in:
misc/vm_configs/xmls/config-xmls/generic
misc/vm_configs/xmls/config-xmls/template

Tracked-On: #5425
Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
2020-11-02 08:52:52 +08:00
Yang, Yu-chu 6b8ec62b52 acrn-config: insert vuart device information to pci_dev.c
- Find unused bdf for SOS and pre-launched VM's pci vuart if it's
enabled
- The vuart cannot detect the function difference, find the unused vbdf
based on "dev" increment

Tracked-On: #5425
Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
2020-11-02 08:52:52 +08:00
Yang, Yu-chu 53c488844f acrn-config: add functions to get pci vuarts information from xml
Add functions to get pci vuarts information and vuarts conunt per vm

Tracked-On: #5425
Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
2020-11-02 08:52:52 +08:00
Yang, Yu-chu 98f922e6a9 acrn-config: find unused vbar base for pci vuarts
Allocate unused vbar for pci based vuarts when the it's enabled for SOS
and/or pre-launched VMs.

- vuart needs 2 bar, both are 4k size
- for SOS, find unused vbar in the range which is assigned to pci host
bridge. The allocated vbar cannot have confilicts with any existing pci devices
- for pre-launched VMs, find unused vbar in the range 0x80000000 to
0xfffffff. The alloacted vbar cannot have confilicts with any
passthrough devices and mmio

Tracked-On: #5425
Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
2020-11-02 08:52:52 +08:00
David B. Kinder 791b091bbe doc: more prep for upgrading doc build tools
Preparing for upgrading to newer versions of doc building tools
including sphing, doxygen, breathe, docutils, etc.  This PR's changes
still work find with the older tool versions, but should eliminate
issues found while moving to newer tool versions (later).

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-11-01 10:12:17 -08:00
Shiqing Gao 76017ec67f doc: update coding guidelines
- add a rule for function parameter limit

Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
2020-10-30 08:36:21 -07:00
David B. Kinder 62d0088565 doc: doc spelling and grammer fixing
Continuing with additional spelling and grammar fixes missed during
retular reviews.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2020-10-30 08:32:53 -07:00
Shixiong Zhang 22c5dd2c58 acrn-config: fix the wrong vuart name in launch script
when fix the issue of _PM_SystemS5 with life_mngr fail,
the vuart1(tty) item was devided into two parts, the last
part "/dev/tty*" which need to get will be added to the
end, so it should be handled singly, but it will be added
to other item too, such as vuart1(pty).

Tracked-On:#5366

Signed-off-by: Shixiong Zhang <shixiongx.zhang@intel.com>
2020-10-30 21:09:27 +08:00
Mingqiang Chi 0eb50e5668 cleanup vpci structure when shutdown_vm
cleanup vpci structure when shutdown_vm to avoid use uninitialized data
after reboot.

Tracked-On: #4958
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2020-10-30 20:48:37 +08:00
Tao Yuhong 996e8f680c HV: pci-vuart support create vdev hcall
Add cteate method for vmcs9900 vdev in hypercalls.

The destroy method of ivshmem is also suitable for other emulated vdev,
move it into hcall_destroy_vdev() for all emulated vdevs

Tracked-On: #5394
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Reviewed-by: Wang, Yu1 <yu1.wang@intel.com>
2020-10-30 20:41:34 +08:00