hv: riscv improve vSBI base extension implementation

Replace SBI passthrough with proper virtualization of base extension
queries. For the Service VM, forward actual machine vendor/arch/impl
IDs from the underlying SBI. For guest VMs, provide dummy ACRN-specific
IDs to maintain isolation.

Changes:
- Return vSBI spec version 2.0 for GET_SPEC_VERSION
- Return ACRN implementation ID (55) and version for GET_IMP_ID/GET_IMP_VERSION
- Forward real mvendorid/marchid/mimpid to Service VM
- Provide dummy vendor/arch/impl IDs (0/0/0) to guest VMs
- Store machine IDs in vm_arch structure during VM initialization
- Remove unnecessary SBI passthrough for base extension queries

This provides better isolation and control over the virtual SBI
interface exposed to guests.

Tracked-On: #8851
Signed-off-by: Haoyu Tang <haoyu.tang@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
This commit is contained in:
Haoyu Tang
2025-10-23 13:10:52 +08:00
committed by Sun, Victor
parent 3b5847a67b
commit d6b6dc3bc0
4 changed files with 39 additions and 6 deletions

View File

@@ -21,6 +21,9 @@
struct vm_arch {
const struct acrn_vsbi_extension *vsbi_exts[MAX_NUM_SUPPORTED_VSBI_EXT];
uint16_t n_vsbi_exts;
uint64_t mvendorid;
uint64_t marchid;
uint64_t mimpid;
};
struct acrn_vcpu;

View File

@@ -8,6 +8,18 @@
#define RISCV_VSBI_H
#include <types.h>
#include <version.h>
#define VSBI_SPEC_VERSION_MAJOR 0x2U
#define VSBI_SPEC_VERSION_MINOR 0x0U
#define VSBI_SPEC_VERSION (VSBI_SPEC_VERSION_MAJOR << 24 | VSBI_SPEC_VERSION_MINOR)
#define VSBI_ACRN_VERSION_MAJOR HV_API_MAJOR_VERSION
#define VSBI_ACRN_VERSION_MINOR HV_API_MINOR_VERSION
#define VSBI_ACRN_VERSION (VSBI_ACRN_VERSION_MAJOR << 24 | VSBI_ACRN_VERSION_MINOR)
#define VSBI_ACRN_IMPID 55U /* FIXME: once official ID confirmed */
#define VSBI_ACRN_MVENDORID 0U /* dummy MVENDORID for guest VM */
#define VSBI_ACRN_MARCHID 0U /* dummy MARCHID for guest VM */
#define VSBI_ACRN_MIMPID 0U /* dummy MIMPID for guest VM */
#define MAX_NUM_SUPPORTED_VSBI_EXT 8