From d808031a04c8f82e18593d1332dd4d4a9e3c0abe Mon Sep 17 00:00:00 2001 From: Mingqiang Chi Date: Thu, 18 Jun 2020 13:03:40 +0800 Subject: [PATCH] remove spin lock for micro code update remove spin lock for micro code update since the guest operating system will take lock Tracked-On: #4958 Signed-off-by: Mingqiang Chi --- hypervisor/arch/x86/guest/ucode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hypervisor/arch/x86/guest/ucode.c b/hypervisor/arch/x86/guest/ucode.c index 6ebdba60f..946997e99 100644 --- a/hypervisor/arch/x86/guest/ucode.c +++ b/hypervisor/arch/x86/guest/ucode.c @@ -17,7 +17,6 @@ #define MICRO_CODE_SIZE_MAX 0x40000U static uint8_t micro_code[MICRO_CODE_SIZE_MAX]; -static spinlock_t micro_code_lock = { .head = 0U, .tail = 0U }; uint64_t get_microcode_version(void) { @@ -40,6 +39,9 @@ static inline size_t get_ucode_data_size(const struct ucode_header *uhdr) return ((uhdr->data_size != 0U) ? uhdr->data_size : 2000U); } +/* the guest operating system should guarantee it won't issue 2nd micro code update + * when the 1st micro code update is on-going. + */ void acrn_update_ucode(struct acrn_vcpu *vcpu, uint64_t v) { uint64_t gva, fault_addr = 0UL; @@ -48,7 +50,6 @@ void acrn_update_ucode(struct acrn_vcpu *vcpu, uint64_t v) int32_t err; uint32_t err_code; - spinlock_obtain(µ_code_lock); gva = v - sizeof(struct ucode_header); err_code = 0U; @@ -78,5 +79,4 @@ void acrn_update_ucode(struct acrn_vcpu *vcpu, uint64_t v) } } } - spinlock_release(µ_code_lock); }