mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-09 17:07:00 +00:00
dm:refine comments and variables name about data stolen memory
"gsm" term is not precise to describe GPU stolen memory, It should be "dsm", which acronyms for data stolen memory. Tracked-On: #4700 Signed-off-by: Junming Liu <junming.liu@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com> Reviewed-by: Liu XinYun <xinyun.liu@intel.com> Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
parent
1e3df01362
commit
b45c24b062
@ -59,9 +59,9 @@
|
|||||||
|
|
||||||
#define PCI_BDF_GPU 0x00000010 /* 00:02.0 */
|
#define PCI_BDF_GPU 0x00000010 /* 00:02.0 */
|
||||||
|
|
||||||
#define GPU_GSM_SIZE 0x4000000
|
#define GPU_DSM_SIZE 0x4000000
|
||||||
/* set gsm gpa=0xDB000000, which is reserved in e820 table */
|
/* set dsm gpa=0xDB000000, which is reserved in e820 table */
|
||||||
#define GPU_GSM_GPA 0xDB000000
|
#define GPU_DSM_GPA 0xDB000000
|
||||||
|
|
||||||
#define GPU_OPREGION_SIZE 0x3000
|
#define GPU_OPREGION_SIZE 0x3000
|
||||||
/* set opregion gpa=0xDFFFD000, which is reserved in e820 table.
|
/* set opregion gpa=0xDFFFD000, which is reserved in e820 table.
|
||||||
@ -77,7 +77,7 @@ extern uint64_t audio_nhlt_len;
|
|||||||
static int pciaccess_ref_cnt;
|
static int pciaccess_ref_cnt;
|
||||||
static pthread_mutex_t ref_cnt_mtx = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t ref_cnt_mtx = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
uint32_t gsm_start_hpa = 0;
|
uint32_t dsm_start_hpa = 0;
|
||||||
uint32_t opregion_start_hpa = 0;
|
uint32_t opregion_start_hpa = 0;
|
||||||
|
|
||||||
struct passthru_dev {
|
struct passthru_dev {
|
||||||
@ -524,12 +524,12 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
|||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (ptdev->phys_bdf == PCI_BDF_GPU) {
|
if (ptdev->phys_bdf == PCI_BDF_GPU) {
|
||||||
uint32_t gsm_phys, opregion_phys;
|
uint32_t dsm_phys, opregion_phys;
|
||||||
/* get gsm hpa */
|
/* get dsm hpa */
|
||||||
gsm_phys = read_config(ptdev->phys_dev, PCIR_BDSM, 4);
|
dsm_phys = read_config(ptdev->phys_dev, PCIR_BDSM, 4);
|
||||||
gsm_start_hpa = gsm_phys & PCIM_BDSM_GSM_MASK;
|
dsm_start_hpa = dsm_phys & PCIM_BDSM_MASK;
|
||||||
/* initialize the EPT mapping for passthrough GPU gsm region */
|
/* initialize the EPT mapping for passthrough GPU dsm region */
|
||||||
vm_map_ptdev_mmio(ctx, 0, 2, 0, GPU_GSM_GPA, GPU_GSM_SIZE, gsm_start_hpa);
|
vm_map_ptdev_mmio(ctx, 0, 2, 0, GPU_DSM_GPA, GPU_DSM_SIZE, dsm_start_hpa);
|
||||||
|
|
||||||
/* get opregion hpa */
|
/* get opregion hpa */
|
||||||
opregion_phys = read_config(ptdev->phys_dev, PCIR_ASLS_CTL, 4);
|
opregion_phys = read_config(ptdev->phys_dev, PCIR_ASLS_CTL, 4);
|
||||||
@ -537,7 +537,7 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
|||||||
/* initialize the EPT mapping for passthrough GPU opregion */
|
/* initialize the EPT mapping for passthrough GPU opregion */
|
||||||
vm_map_ptdev_mmio(ctx, 0, 2, 0, GPU_OPREGION_GPA, GPU_OPREGION_SIZE, opregion_start_hpa);
|
vm_map_ptdev_mmio(ctx, 0, 2, 0, GPU_OPREGION_GPA, GPU_OPREGION_SIZE, opregion_start_hpa);
|
||||||
|
|
||||||
pci_set_cfgdata32(dev, PCIR_BDSM, GPU_GSM_GPA | (gsm_phys & ~PCIM_BDSM_GSM_MASK));
|
pci_set_cfgdata32(dev, PCIR_BDSM, GPU_DSM_GPA | (dsm_phys & ~PCIM_BDSM_MASK));
|
||||||
pci_set_cfgdata32(dev, PCIR_ASLS_CTL, GPU_OPREGION_GPA | (opregion_phys & ~PCIM_ASLS_OPREGION_MASK));
|
pci_set_cfgdata32(dev, PCIR_ASLS_CTL, GPU_OPREGION_GPA | (opregion_phys & ~PCIM_ASLS_OPREGION_MASK));
|
||||||
|
|
||||||
pcidev.type = QUIRK_PTDEV;
|
pcidev.type = QUIRK_PTDEV;
|
||||||
@ -608,7 +608,7 @@ passthru_deinit(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ptdev->phys_bdf == PCI_BDF_GPU) {
|
if (ptdev->phys_bdf == PCI_BDF_GPU) {
|
||||||
vm_unmap_ptdev_mmio(ctx, 0, 2, 0, GPU_GSM_GPA, GPU_GSM_SIZE, gsm_start_hpa);
|
vm_unmap_ptdev_mmio(ctx, 0, 2, 0, GPU_DSM_GPA, GPU_DSM_SIZE, dsm_start_hpa);
|
||||||
vm_unmap_ptdev_mmio(ctx, 0, 2, 0, GPU_OPREGION_GPA, GPU_OPREGION_SIZE, opregion_start_hpa);
|
vm_unmap_ptdev_mmio(ctx, 0, 2, 0, GPU_OPREGION_GPA, GPU_OPREGION_SIZE, opregion_start_hpa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1067,7 +1067,7 @@
|
|||||||
|
|
||||||
/* Graphics definitions */
|
/* Graphics definitions */
|
||||||
#define PCIR_BDSM 0x5C /* BDSM graphics base data of stolen memory register */
|
#define PCIR_BDSM 0x5C /* BDSM graphics base data of stolen memory register */
|
||||||
#define PCIM_BDSM_GSM_MASK 0xFFF00000 /* bits 31:20 contains the base address of stolen memory */
|
#define PCIM_BDSM_MASK 0xFFF00000
|
||||||
#define PCIR_ASLS_CTL 0xFC /* Opregion start addr register */
|
#define PCIR_ASLS_CTL 0xFC /* Opregion start addr register */
|
||||||
#define PCIM_ASLS_OPREGION_MASK 0xFFFFF000 /* opregion need 4KB aligned */
|
#define PCIM_ASLS_OPREGION_MASK 0xFFFFF000 /* opregion need 4KB aligned */
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user