Re: [PATCH v3 3/3] dm:refine comments and variables name about data stolen memory


Wu, Xiaoguang
 

Xgwu:

I think this patch should be placed as 1/3.

-----Original Message-----
From: acrn-dev@... <acrn-dev@...> On
Behalf Of Junming Liu
Sent: Thursday, April 23, 2020 11:08 AM
To: acrn-dev@...
Cc: Liu, Junming <junming.liu@...>
Subject: [acrn-dev] [PATCH v3 3/3] 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@...>
---
devicemodel/hw/pci/passthrough.c | 34 +++++++++++++++++----------------
-
1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/devicemodel/hw/pci/passthrough.c
b/devicemodel/hw/pci/passthrough.c
index 27323b6..904e33a 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 {
@@ -432,7 +432,7 @@ void
passthru_gpu_dsm_opregion(struct vmctx *ctx, struct passthru_dev *ptdev,
struct acrn_assign_pcidev *pcidev, uint16_t device) {
- uint32_t opregion_phys, gsm_mask_val;
+ uint32_t opregion_phys, dsm_mask_val;

switch (device) {
/* If on EHL platform */
@@ -440,12 +440,12 @@ passthru_gpu_dsm_opregion(struct vmctx *ctx,
struct passthru_dev *ptdev,
/* On EHL platform, BDSM register has 64 bits.
* bits 63:20 contains the base address of stolen memory
*/
- gsm_start_hpa = read_config(ptdev->phys_dev,
PCIR_GEN11_BDSM_DW0, 4);
- gsm_mask_val = gsm_start_hpa & ~PCIM_BDSM_MASK;
- gsm_start_hpa &= PCIM_BDSM_MASK;
- gsm_start_hpa |= (uint64_t)read_config(ptdev->phys_dev,
PCIR_GEN11_BDSM_DW1, 4) << 32;
+ dsm_start_hpa = read_config(ptdev->phys_dev,
PCIR_GEN11_BDSM_DW0, 4);
+ dsm_mask_val = dsm_start_hpa & ~PCIM_BDSM_MASK;
+ dsm_start_hpa &= PCIM_BDSM_MASK;
+ dsm_start_hpa |= (uint64_t)read_config(ptdev->phys_dev,
+PCIR_GEN11_BDSM_DW1, 4) << 32;

- pci_set_cfgdata32(ptdev->dev, PCIR_GEN11_BDSM_DW0,
GPU_GSM_GPA | gsm_mask_val);
+ pci_set_cfgdata32(ptdev->dev, PCIR_GEN11_BDSM_DW0,
GPU_DSM_GPA |
+dsm_mask_val);
/* write 0 to high 32-bits of BDSM on EHL platform */
pci_set_cfgdata32(ptdev->dev, PCIR_GEN11_BDSM_DW1, 0);

@@ -454,18 +454,18 @@ passthru_gpu_dsm_opregion(struct vmctx *ctx,
struct passthru_dev *ptdev,
/* If on default platforms, such as KBL,WHL */
default:
/* bits 31:20 contains the base address of stolen memory */
- gsm_start_hpa = read_config(ptdev->phys_dev, PCIR_BDSM,
4);
- gsm_mask_val = gsm_start_hpa & ~PCIM_BDSM_MASK;
- gsm_start_hpa &= PCIM_BDSM_MASK;
+ dsm_start_hpa = read_config(ptdev->phys_dev, PCIR_BDSM,
4);
+ dsm_mask_val = dsm_start_hpa & ~PCIM_BDSM_MASK;
+ dsm_start_hpa &= PCIM_BDSM_MASK;

- pci_set_cfgdata32(ptdev->dev, PCIR_BDSM,
GPU_GSM_GPA | gsm_mask_val);
+ pci_set_cfgdata32(ptdev->dev, PCIR_BDSM,
GPU_DSM_GPA | dsm_mask_val);

ptdev->has_virt_pcicfg_regs =
&has_virt_pcicfg_regs_on_def_gpu;
break;
}

- /* 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);
+ /* 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);
@@ -668,7 +668,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);
}

--
2.7.4


Join acrn-dev@lists.projectacrn.org to automatically receive all group messages.