diff options
| author | Miquel Raynal <miquel.raynal@bootlin.com> | 2022-05-20 13:58:54 +0200 | 
|---|---|---|
| committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2022-05-20 13:58:54 +0200 | 
| commit | e6828be5edcfea25cd70a2d1de41085c67ef9fa5 (patch) | |
| tree | 489ae4cdb47a4d83940e2472f49a3c601806b70e /arch/x86/kvm/hyperv.c | |
| parent | 1fefc8ecb834c88edfc27e712d683872d0c541dd (diff) | |
| parent | c47452194641b5d27c20e557c84a46c85fd7ce37 (diff) | |
Merge tag 'spi-nor/for-5.19' into mtd/next
SPI NOR core changes:
- Read back written SR value to make sure the write was done correctly.
- Introduce a common function for Read ID that manufacturer drivers can
  use to verify the Octal DTR switch worked correctly.
- Add helpers for read/write any register commands so manufacturer
  drivers don't open code it every time.
- Clarify rdsr dummy cycles documentation.
- Add debugfs entry to expose internal flash parameters and state.
SPI NOR manufacturer drivers changes:
- Add support for Winbond W25Q512NW-IM, and Eon EN25QH256A.
- Move spi_nor_write_ear() to Winbond module since only Winbond flashes
  use it.
- Rework Micron and Cypress Octal DTR enable methods to improve
  readability.
- Use the common Read ID function to verify switch to Octal DTR mode for
  Micron and Cypress flashes.
- Skip polling status on volatile register writes for Micron and Cypress
  flashes since the operation is instant.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'arch/x86/kvm/hyperv.c')
| -rw-r--r-- | arch/x86/kvm/hyperv.c | 40 | 
1 files changed, 8 insertions, 32 deletions
diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 123b677111c5..46f9dfb60469 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -1135,11 +1135,13 @@ void kvm_hv_setup_tsc_page(struct kvm *kvm,  	BUILD_BUG_ON(sizeof(tsc_seq) != sizeof(hv->tsc_ref.tsc_sequence));  	BUILD_BUG_ON(offsetof(struct ms_hyperv_tsc_page, tsc_sequence) != 0); +	mutex_lock(&hv->hv_lock); +  	if (hv->hv_tsc_page_status == HV_TSC_PAGE_BROKEN || +	    hv->hv_tsc_page_status == HV_TSC_PAGE_SET ||  	    hv->hv_tsc_page_status == HV_TSC_PAGE_UNSET) -		return; +		goto out_unlock; -	mutex_lock(&hv->hv_lock);  	if (!(hv->hv_tsc_page & HV_X64_MSR_TSC_REFERENCE_ENABLE))  		goto out_unlock; @@ -1201,45 +1203,19 @@ out_unlock:  	mutex_unlock(&hv->hv_lock);  } -void kvm_hv_invalidate_tsc_page(struct kvm *kvm) +void kvm_hv_request_tsc_page_update(struct kvm *kvm)  {  	struct kvm_hv *hv = to_kvm_hv(kvm); -	u64 gfn; -	int idx; - -	if (hv->hv_tsc_page_status == HV_TSC_PAGE_BROKEN || -	    hv->hv_tsc_page_status == HV_TSC_PAGE_UNSET || -	    tsc_page_update_unsafe(hv)) -		return;  	mutex_lock(&hv->hv_lock); -	if (!(hv->hv_tsc_page & HV_X64_MSR_TSC_REFERENCE_ENABLE)) -		goto out_unlock; - -	/* Preserve HV_TSC_PAGE_GUEST_CHANGED/HV_TSC_PAGE_HOST_CHANGED states */ -	if (hv->hv_tsc_page_status == HV_TSC_PAGE_SET) -		hv->hv_tsc_page_status = HV_TSC_PAGE_UPDATING; +	if (hv->hv_tsc_page_status == HV_TSC_PAGE_SET && +	    !tsc_page_update_unsafe(hv)) +		hv->hv_tsc_page_status = HV_TSC_PAGE_HOST_CHANGED; -	gfn = hv->hv_tsc_page >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT; - -	hv->tsc_ref.tsc_sequence = 0; - -	/* -	 * Take the srcu lock as memslots will be accessed to check the gfn -	 * cache generation against the memslots generation. -	 */ -	idx = srcu_read_lock(&kvm->srcu); -	if (kvm_write_guest(kvm, gfn_to_gpa(gfn), -			    &hv->tsc_ref, sizeof(hv->tsc_ref.tsc_sequence))) -		hv->hv_tsc_page_status = HV_TSC_PAGE_BROKEN; -	srcu_read_unlock(&kvm->srcu, idx); - -out_unlock:  	mutex_unlock(&hv->hv_lock);  } -  static bool hv_check_msr_access(struct kvm_vcpu_hv *hv_vcpu, u32 msr)  {  	if (!hv_vcpu->enforce_cpuid)  | 
