mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
Merge 915697c2e6 ("Revert "drm/amd/display: Use HW lock mgr for PSR1"") into android14-6.1-lts
Steps on the way to 6.1.129 Change-Id: I7e750d014f341867c34180b22700467141e37a2f Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -1331,8 +1331,14 @@ static struct vsie_page *get_vsie_page(struct kvm *kvm, unsigned long addr)
|
||||
page = radix_tree_lookup(&kvm->arch.vsie.addr_to_page, addr >> 9);
|
||||
rcu_read_unlock();
|
||||
if (page) {
|
||||
if (page_ref_inc_return(page) == 2)
|
||||
return page_to_virt(page);
|
||||
if (page_ref_inc_return(page) == 2) {
|
||||
if (page->index == addr)
|
||||
return page_to_virt(page);
|
||||
/*
|
||||
* We raced with someone reusing + putting this vsie
|
||||
* page before we grabbed it.
|
||||
*/
|
||||
}
|
||||
page_ref_dec(page);
|
||||
}
|
||||
|
||||
@@ -1362,15 +1368,20 @@ static struct vsie_page *get_vsie_page(struct kvm *kvm, unsigned long addr)
|
||||
kvm->arch.vsie.next++;
|
||||
kvm->arch.vsie.next %= nr_vcpus;
|
||||
}
|
||||
radix_tree_delete(&kvm->arch.vsie.addr_to_page, page->index >> 9);
|
||||
if (page->index != ULONG_MAX)
|
||||
radix_tree_delete(&kvm->arch.vsie.addr_to_page,
|
||||
page->index >> 9);
|
||||
}
|
||||
page->index = addr;
|
||||
/* double use of the same address */
|
||||
/* Mark it as invalid until it resides in the tree. */
|
||||
page->index = ULONG_MAX;
|
||||
|
||||
/* Double use of the same address or allocation failure. */
|
||||
if (radix_tree_insert(&kvm->arch.vsie.addr_to_page, addr >> 9, page)) {
|
||||
page_ref_dec(page);
|
||||
mutex_unlock(&kvm->arch.vsie.mutex);
|
||||
return NULL;
|
||||
}
|
||||
page->index = addr;
|
||||
mutex_unlock(&kvm->arch.vsie.mutex);
|
||||
|
||||
vsie_page = page_to_virt(page);
|
||||
@@ -1463,7 +1474,9 @@ void kvm_s390_vsie_destroy(struct kvm *kvm)
|
||||
vsie_page = page_to_virt(page);
|
||||
release_gmap_shadow(vsie_page);
|
||||
/* free the radix tree entry */
|
||||
radix_tree_delete(&kvm->arch.vsie.addr_to_page, page->index >> 9);
|
||||
if (page->index != ULONG_MAX)
|
||||
radix_tree_delete(&kvm->arch.vsie.addr_to_page,
|
||||
page->index >> 9);
|
||||
__free_page(page);
|
||||
}
|
||||
kvm->arch.vsie.page_count = 0;
|
||||
|
||||
@@ -65,8 +65,7 @@ void dmub_hw_lock_mgr_inbox0_cmd(struct dc_dmub_srv *dmub_srv,
|
||||
|
||||
bool should_use_dmub_lock(struct dc_link *link)
|
||||
{
|
||||
if (link->psr_settings.psr_version == DC_PSR_VERSION_SU_1 ||
|
||||
link->psr_settings.psr_version == DC_PSR_VERSION_1)
|
||||
if (link->psr_settings.psr_version == DC_PSR_VERSION_SU_1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1759,7 +1759,6 @@ static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu,
|
||||
|
||||
gpu_metrics->average_gfx_activity = metrics.AverageGfxActivity;
|
||||
gpu_metrics->average_umc_activity = metrics.AverageUclkActivity;
|
||||
gpu_metrics->average_mm_activity = 0;
|
||||
|
||||
/* Valid power data is available only from primary die */
|
||||
if (aldebaran_is_primary(smu)) {
|
||||
|
||||
@@ -567,6 +567,9 @@ ksmbd_ipc_spnego_authen_request(const char *spnego_blob, int blob_len)
|
||||
struct ksmbd_spnego_authen_request *req;
|
||||
struct ksmbd_spnego_authen_response *resp;
|
||||
|
||||
if (blob_len > KSMBD_IPC_MAX_PAYLOAD)
|
||||
return NULL;
|
||||
|
||||
msg = ipc_msg_alloc(sizeof(struct ksmbd_spnego_authen_request) +
|
||||
blob_len + 1);
|
||||
if (!msg)
|
||||
@@ -746,6 +749,9 @@ struct ksmbd_rpc_command *ksmbd_rpc_write(struct ksmbd_session *sess, int handle
|
||||
struct ksmbd_rpc_command *req;
|
||||
struct ksmbd_rpc_command *resp;
|
||||
|
||||
if (payload_sz > KSMBD_IPC_MAX_PAYLOAD)
|
||||
return NULL;
|
||||
|
||||
msg = ipc_msg_alloc(sizeof(struct ksmbd_rpc_command) + payload_sz + 1);
|
||||
if (!msg)
|
||||
return NULL;
|
||||
@@ -794,6 +800,9 @@ struct ksmbd_rpc_command *ksmbd_rpc_ioctl(struct ksmbd_session *sess, int handle
|
||||
struct ksmbd_rpc_command *req;
|
||||
struct ksmbd_rpc_command *resp;
|
||||
|
||||
if (payload_sz > KSMBD_IPC_MAX_PAYLOAD)
|
||||
return NULL;
|
||||
|
||||
msg = ipc_msg_alloc(sizeof(struct ksmbd_rpc_command) + payload_sz + 1);
|
||||
if (!msg)
|
||||
return NULL;
|
||||
|
||||
@@ -879,6 +879,15 @@ static inline struct kvm_io_bus *kvm_get_bus(struct kvm *kvm, enum kvm_bus idx)
|
||||
static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
|
||||
{
|
||||
int num_vcpus = atomic_read(&kvm->online_vcpus);
|
||||
|
||||
/*
|
||||
* Explicitly verify the target vCPU is online, as the anti-speculation
|
||||
* logic only limits the CPU's ability to speculate, e.g. given a "bad"
|
||||
* index, clamping the index to 0 would return vCPU0, not NULL.
|
||||
*/
|
||||
if (i >= num_vcpus)
|
||||
return NULL;
|
||||
|
||||
i = array_index_nospec(i, num_vcpus);
|
||||
|
||||
/* Pairs with smp_wmb() in kvm_vm_ioctl_create_vcpu. */
|
||||
|
||||
Reference in New Issue
Block a user