From 9c79e2ebdc1cd804736aeba27cfc88cf6bf7f339 Mon Sep 17 00:00:00 2001 From: Yonghua Huang Date: Fri, 14 May 2021 13:01:22 +0800 Subject: [PATCH] dm: clean legacy software SRAM names Remove below legacy SSRAM names: psram -> ssram ptct -> rtct Tracked-On: #6015 Signed-off-by: Yonghua Huang --- devicemodel/core/main.c | 10 ++++----- devicemodel/hw/platform/acpi/acpi.c | 6 +++--- devicemodel/hw/platform/acpi/rtct.c | 32 ++++++++++++++--------------- devicemodel/include/dm.h | 2 +- devicemodel/include/rtct.h | 4 ++-- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/devicemodel/core/main.c b/devicemodel/core/main.c index 816bf066f..bc6de4d1b 100644 --- a/devicemodel/core/main.c +++ b/devicemodel/core/main.c @@ -91,7 +91,7 @@ bool stdio_in_use; bool lapic_pt; bool is_rtvm; bool pt_tpm2; -bool pt_ptct; +bool pt_rtct; bool is_winvm; bool skip_pci_mem64bar_workaround = false; @@ -148,7 +148,7 @@ usage(int code) " %*s [--cpu_affinity pCPUs] [--lapic_pt] [--rtvm] [--windows]\n" " %*s [--debugexit] [--logger_setting param_setting]\n" " %*s [--pm_notify_channel] [--pm_by_vuart vuart_node]\n" - " %*s [--psram] \n" + " %*s [--ssram] \n" " -A: create ACPI tables\n" " -B: bootargs for kernel\n" " -E: elf image path\n" @@ -167,7 +167,7 @@ usage(int code) " --mac_seed: set a platform unique string as a seed for generate mac address\n" " --vsbl: vsbl file path\n" " --ovmf: ovmf file path\n" - " --psram: Enable Software SRAM passthrough\n" + " --ssram: Enable Software SRAM passthrough\n" " --cpu_affinity: list of pCPUs assigned to this VM\n" " --part_info: guest partition info file path\n" " --enable_trusty: enable trusty for guest\n" @@ -796,7 +796,7 @@ static struct option long_options[] = { {"vtpm2", required_argument, 0, CMD_OPT_VTPM2}, {"lapic_pt", no_argument, 0, CMD_OPT_LAPIC_PT}, {"rtvm", no_argument, 0, CMD_OPT_RTVM}, - {"psram", no_argument, 0, CMD_OPT_SOFTWARE_SRAM}, + {"ssram", no_argument, 0, CMD_OPT_SOFTWARE_SRAM}, {"logger_setting", required_argument, 0, CMD_OPT_LOGGER_SETTING}, {"pm_notify_channel", required_argument, 0, CMD_OPT_PM_NOTIFY_CHANNEL}, {"pm_by_vuart", required_argument, 0, CMD_OPT_PM_BY_VUART}, @@ -942,7 +942,7 @@ main(int argc, char *argv[]) break; case CMD_OPT_SOFTWARE_SRAM: /* TODO: we need to support parameter to specify Software SRAM size in the future */ - pt_ptct = true; + pt_rtct = true; break; case CMD_OPT_ACPIDEV_PT: if (parse_pt_acpidev(optarg) != 0) diff --git a/devicemodel/hw/platform/acpi/acpi.c b/devicemodel/hw/platform/acpi/acpi.c index 8eb031c49..13fcea8ee 100644 --- a/devicemodel/hw/platform/acpi/acpi.c +++ b/devicemodel/hw/platform/acpi/acpi.c @@ -192,7 +192,7 @@ basl_fwrite_rsdt(FILE *fp, struct vmctx *ctx) EFPRINTF(fp, "[0004]\t\tACPI Table Address %u : %08X\n", num++, basl_acpi_base + TPM2_OFFSET); - if (pt_ptct) { + if (pt_rtct) { EFPRINTF(fp, "[0004]\t\tACPI Table Address %u : %08X\n", num++, basl_acpi_base + RTCT_OFFSET); } @@ -239,7 +239,7 @@ basl_fwrite_xsdt(FILE *fp, struct vmctx *ctx) EFPRINTF(fp, "[0004]\t\tACPI Table Address %u : 00000000%08X\n", num++, basl_acpi_base + TPM2_OFFSET); - if (pt_ptct) { + if (pt_rtct) { EFPRINTF(fp, "[0004]\t\tACPI Table Address %u : 00000000%08X\n", num++, basl_acpi_base + RTCT_OFFSET); } @@ -1208,7 +1208,7 @@ acpi_build(struct vmctx *ctx, int ncpu) i++; } - if (pt_ptct) { + if (pt_rtct) { create_and_inject_vrtct(ctx); } diff --git a/devicemodel/hw/platform/acpi/rtct.c b/devicemodel/hw/platform/acpi/rtct.c index f1875bd77..357ce49f8 100644 --- a/devicemodel/hw/platform/acpi/rtct.c +++ b/devicemodel/hw/platform/acpi/rtct.c @@ -23,7 +23,7 @@ #include "rtct.h" #define RTCT_ENTRY_HEADER_SIZE 8 -#define RTCT_PSRAM_HEADER_SIZE (RTCT_ENTRY_HEADER_SIZE + 20) +#define RTCT_SSRAM_HEADER_SIZE (RTCT_ENTRY_HEADER_SIZE + 20) #define RTCT_MEM_HI_HEADER_SIZE (RTCT_ENTRY_HEADER_SIZE + 8) #define BITMASK(nr) (1U << nr) @@ -113,18 +113,18 @@ static inline void add_rtct_entry(struct acpi_table_hdr *rtct, struct rtct_entry * * @return 0 on success and non-zero on fail. */ -static int vrtct_add_psram_entry(struct acpi_table_hdr *vrtct, uint32_t cache_level, uint64_t base, uint32_t ways, +static int vrtct_add_ssram_entry(struct acpi_table_hdr *vrtct, uint32_t cache_level, uint64_t base, uint32_t ways, uint32_t size, uint64_t sw_sram_pcpu_bitmask, uint64_t guest_pcpu_bitmask) { int vlapicid_num; struct rtct_entry *rtct_entry; - struct rtct_entry_data_psram *sw_sram; + struct rtct_entry_data_ssram *sw_sram; rtct_entry = get_free_rtct_entry(vrtct); rtct_entry->format = 1; - rtct_entry->type = RTCT_ENTRY_TYPE_PSRAM; + rtct_entry->type = RTCT_ENTRY_TYPE_SSRAM; - sw_sram = (struct rtct_entry_data_psram *)rtct_entry->data; + sw_sram = (struct rtct_entry_data_ssram *)rtct_entry->data; sw_sram->cache_level = cache_level; sw_sram->base = base; sw_sram->ways = ways; @@ -134,7 +134,7 @@ static int vrtct_add_psram_entry(struct acpi_table_hdr *vrtct, uint32_t cache_le if (vlapicid_num <= 0) return -1; - rtct_entry->size = RTCT_PSRAM_HEADER_SIZE + (vlapicid_num * sizeof(uint32_t)); + rtct_entry->size = RTCT_SSRAM_HEADER_SIZE + (vlapicid_num * sizeof(uint32_t)); add_rtct_entry(vrtct, rtct_entry); return 0; } @@ -184,15 +184,15 @@ static int vrtct_add_mem_hierarchy_entry(struct acpi_table_hdr *vrtct, uint32_t static void remap_software_sram_regions(struct acpi_table_hdr *vrtct) { struct rtct_entry *entry; - struct rtct_entry_data_psram *sw_sram_region; + struct rtct_entry_data_ssram *sw_sram_region; uint64_t hpa_bottom, hpa_top; hpa_bottom = (uint64_t)-1; hpa_top = 0; foreach_rtct_entry(vrtct, entry) { - if (entry->type == RTCT_ENTRY_TYPE_PSRAM) { - sw_sram_region = (struct rtct_entry_data_psram *)entry->data; + if (entry->type == RTCT_ENTRY_TYPE_SSRAM) { + sw_sram_region = (struct rtct_entry_data_ssram *)entry->data; if (hpa_bottom > sw_sram_region->base) { hpa_bottom = sw_sram_region->base; } @@ -208,8 +208,8 @@ static void remap_software_sram_regions(struct acpi_table_hdr *vrtct) software_sram_size = hpa_top - hpa_bottom; foreach_rtct_entry(vrtct, entry) { - if (entry->type == RTCT_ENTRY_TYPE_PSRAM) { - sw_sram_region = (struct rtct_entry_data_psram *)entry->data; + if (entry->type == RTCT_ENTRY_TYPE_SSRAM) { + sw_sram_region = (struct rtct_entry_data_ssram *)entry->data; sw_sram_region->base = software_sram_base_gpa + (sw_sram_region->base - hpa_bottom); } } @@ -231,16 +231,16 @@ static int passthru_rtct_to_guest(struct acpi_table_hdr *vrtct, struct acpi_tabl int i, cpu_num, rc = 0; uint64_t sw_sram_pcpu_bitmask; struct rtct_entry *entry; - struct rtct_entry_data_psram *sw_sram; + struct rtct_entry_data_ssram *sw_sram; struct rtct_entry_data_mem_hi_latency *mem_hi; foreach_rtct_entry(native_rtct, entry) { switch (entry->type) { - case RTCT_ENTRY_TYPE_PSRAM: + case RTCT_ENTRY_TYPE_SSRAM: { /* Get native CPUs of Software SRAM region */ - cpu_num = (entry->size - RTCT_PSRAM_HEADER_SIZE) / sizeof(uint32_t); - sw_sram = (struct rtct_entry_data_psram *)entry->data; + cpu_num = (entry->size - RTCT_SSRAM_HEADER_SIZE) / sizeof(uint32_t); + sw_sram = (struct rtct_entry_data_ssram *)entry->data; sw_sram_pcpu_bitmask = 0; for (i = 0; i < cpu_num; i++) { sw_sram_pcpu_bitmask |= (1U << lapicid_to_cpuid(sw_sram->apic_id_tbl[i])); @@ -253,7 +253,7 @@ static int passthru_rtct_to_guest(struct acpi_table_hdr *vrtct, struct acpi_tabl * in host physical address space, this 'base' will be updated to * GPA when mapping all Software SRAM regions from HPA to GPA. */ - rc = vrtct_add_psram_entry(vrtct, sw_sram->cache_level, sw_sram->base, + rc = vrtct_add_ssram_entry(vrtct, sw_sram->cache_level, sw_sram->base, sw_sram->ways, sw_sram->size, sw_sram_pcpu_bitmask, guest_pcpu_bitmask); } } diff --git a/devicemodel/include/dm.h b/devicemodel/include/dm.h index 84a2e333b..3e8e6b23d 100644 --- a/devicemodel/include/dm.h +++ b/devicemodel/include/dm.h @@ -51,7 +51,7 @@ extern char *mac_seed; extern bool lapic_pt; extern bool is_rtvm; extern bool pt_tpm2; -extern bool pt_ptct; +extern bool pt_rtct; extern bool is_winvm; int vmexit_task_switch(struct vmctx *ctx, struct vhm_request *vhm_req, diff --git a/devicemodel/include/rtct.h b/devicemodel/include/rtct.h index 2588dde19..c8b2ba90f 100644 --- a/devicemodel/include/rtct.h +++ b/devicemodel/include/rtct.h @@ -11,7 +11,7 @@ #define RTCT_ENTRY_TYPE_PTCM_BINARY 2U #define RTCT_ENTRY_TYPE_WRC_L3_MASKS 3U #define RTCT_ENTRY_TYPE_GT_L3_MASKS 4U -#define RTCT_ENTRY_TYPE_PSRAM 5U +#define RTCT_ENTRY_TYPE_SSRAM 5U #define RTCT_ENTRY_TYPE_STREAM_DATAPATH 6U #define RTCT_ENTRY_TYPE_TIMEAWARE_SUBSYS 7U #define RTCT_ENTRY_TYPE_RT_IOMMU 8U @@ -24,7 +24,7 @@ struct rtct_entry { uint32_t data[64]; } __packed; -struct rtct_entry_data_psram { +struct rtct_entry_data_ssram { uint32_t cache_level; uint64_t base; uint32_t ways;