From b45c24b062ca1c8034b61d72795096fb0ca01a13 Mon Sep 17 00:00:00 2001 From: Junming Liu Date: Fri, 24 Apr 2020 00:07:28 +0800 Subject: [PATCH] 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 Reviewed-by: Zhao Yakui Reviewed-by: Liu XinYun Reviewed-by: Xiaoguang Wu Acked-by: Yu Wang --- devicemodel/hw/pci/passthrough.c | 24 ++++++++++++------------ devicemodel/include/pcireg.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/devicemodel/hw/pci/passthrough.c b/devicemodel/hw/pci/passthrough.c index 1aa322162..858599fc8 100644 --- a/devicemodel/hw/pci/passthrough.c +++ b/devicemodel/hw/pci/passthrough.c @@ -59,9 +59,9 @@ #define PCI_BDF_GPU 0x00000010 /* 00:02.0 */ -#define GPU_GSM_SIZE 0x4000000 -/* set gsm gpa=0xDB000000, which is reserved in e820 table */ -#define GPU_GSM_GPA 0xDB000000 +#define GPU_DSM_SIZE 0x4000000 +/* set dsm gpa=0xDB000000, which is reserved in e820 table */ +#define GPU_DSM_GPA 0xDB000000 #define GPU_OPREGION_SIZE 0x3000 /* 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 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; struct passthru_dev { @@ -524,12 +524,12 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts) goto done; if (ptdev->phys_bdf == PCI_BDF_GPU) { - uint32_t gsm_phys, opregion_phys; - /* get gsm hpa */ - gsm_phys = read_config(ptdev->phys_dev, PCIR_BDSM, 4); - gsm_start_hpa = gsm_phys & PCIM_BDSM_GSM_MASK; - /* initialize the EPT mapping for passthrough GPU gsm region */ - vm_map_ptdev_mmio(ctx, 0, 2, 0, GPU_GSM_GPA, GPU_GSM_SIZE, gsm_start_hpa); + uint32_t dsm_phys, opregion_phys; + /* get dsm hpa */ + dsm_phys = read_config(ptdev->phys_dev, PCIR_BDSM, 4); + dsm_start_hpa = dsm_phys & PCIM_BDSM_MASK; + /* initialize the EPT mapping for passthrough GPU dsm region */ + vm_map_ptdev_mmio(ctx, 0, 2, 0, GPU_DSM_GPA, GPU_DSM_SIZE, dsm_start_hpa); /* get opregion hpa */ 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 */ 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)); 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) { - 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); } diff --git a/devicemodel/include/pcireg.h b/devicemodel/include/pcireg.h index e2d8594c1..ca89f0324 100644 --- a/devicemodel/include/pcireg.h +++ b/devicemodel/include/pcireg.h @@ -1067,7 +1067,7 @@ /* Graphics definitions */ #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 PCIM_ASLS_OPREGION_MASK 0xFFFFF000 /* opregion need 4KB aligned */ #endif