diff options
| author | Mark Brown <broonie@kernel.org> | 2020-05-20 16:09:02 +0100 | 
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2020-05-20 16:09:02 +0100 | 
| commit | a24490e0170e4cc6d4fd1f37691f19a106b694ae (patch) | |
| tree | 20964ef269612a2ea33240274bc3422c74a02b15 /virt/kvm/arm/psci.c | |
| parent | 9bcbabafa19b9f27a283777eff32e7d66fcef09c (diff) | |
| parent | 7e73861eb40d591a98628592c6f0182fbf2f6c4d (diff) | |
Merge series "MAINTAINER entries for few ROHM power devices" from Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>:
Add maintainer entries to a few ROHM devices and Linear Ranges
Linear Ranges helpers were refactored out of regulator core to lib so
that other drivers could utilize them too. (I guess power/supply drivers
and possibly clk drivers can benefit from them). As regulators is
currently the main user it makes sense the changes to linear_ranges go
through Mark's tree.
During past two years few ROHM PMIC drivers have been added to
mainstream. They deserve a supporter from ROHM side too :)
Patch 1:
	Maintainer entries for few ROHM IC drivers
Patch 2:
	Maintainer entry for linear ranges helpers
---
Matti Vaittinen (2):
  MAINTAINERS: Add entry for ROHM power management ICs
  MAINTAINERS: Add maintainer entry for linear ranges helper
 MAINTAINERS | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
base-commit: b9bbe6ed63b2b9f2c9ee5cbd0f2c946a2723f4ce
--
2.21.0
--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND
~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]
Diffstat (limited to 'virt/kvm/arm/psci.c')
| -rw-r--r-- | virt/kvm/arm/psci.c | 40 | 
1 files changed, 40 insertions, 0 deletions
diff --git a/virt/kvm/arm/psci.c b/virt/kvm/arm/psci.c index 14a162e295a9..ae364716ee40 100644 --- a/virt/kvm/arm/psci.c +++ b/virt/kvm/arm/psci.c @@ -186,6 +186,33 @@ static void kvm_psci_system_reset(struct kvm_vcpu *vcpu)  	kvm_prepare_system_event(vcpu, KVM_SYSTEM_EVENT_RESET);  } +static void kvm_psci_narrow_to_32bit(struct kvm_vcpu *vcpu) +{ +	int i; + +	/* +	 * Zero the input registers' upper 32 bits. They will be fully +	 * zeroed on exit, so we're fine changing them in place. +	 */ +	for (i = 1; i < 4; i++) +		vcpu_set_reg(vcpu, i, lower_32_bits(vcpu_get_reg(vcpu, i))); +} + +static unsigned long kvm_psci_check_allowed_function(struct kvm_vcpu *vcpu, u32 fn) +{ +	switch(fn) { +	case PSCI_0_2_FN64_CPU_SUSPEND: +	case PSCI_0_2_FN64_CPU_ON: +	case PSCI_0_2_FN64_AFFINITY_INFO: +		/* Disallow these functions for 32bit guests */ +		if (vcpu_mode_is_32bit(vcpu)) +			return PSCI_RET_NOT_SUPPORTED; +		break; +	} + +	return 0; +} +  static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)  {  	struct kvm *kvm = vcpu->kvm; @@ -193,6 +220,10 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)  	unsigned long val;  	int ret = 1; +	val = kvm_psci_check_allowed_function(vcpu, psci_fn); +	if (val) +		goto out; +  	switch (psci_fn) {  	case PSCI_0_2_FN_PSCI_VERSION:  		/* @@ -210,12 +241,16 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)  		val = PSCI_RET_SUCCESS;  		break;  	case PSCI_0_2_FN_CPU_ON: +		kvm_psci_narrow_to_32bit(vcpu); +		fallthrough;  	case PSCI_0_2_FN64_CPU_ON:  		mutex_lock(&kvm->lock);  		val = kvm_psci_vcpu_on(vcpu);  		mutex_unlock(&kvm->lock);  		break;  	case PSCI_0_2_FN_AFFINITY_INFO: +		kvm_psci_narrow_to_32bit(vcpu); +		fallthrough;  	case PSCI_0_2_FN64_AFFINITY_INFO:  		val = kvm_psci_vcpu_affinity_info(vcpu);  		break; @@ -256,6 +291,7 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)  		break;  	} +out:  	smccc_set_retval(vcpu, val, 0, 0, 0);  	return ret;  } @@ -273,6 +309,10 @@ static int kvm_psci_1_0_call(struct kvm_vcpu *vcpu)  		break;  	case PSCI_1_0_FN_PSCI_FEATURES:  		feature = smccc_get_arg1(vcpu); +		val = kvm_psci_check_allowed_function(vcpu, feature); +		if (val) +			break; +  		switch(feature) {  		case PSCI_0_2_FN_PSCI_VERSION:  		case PSCI_0_2_FN_CPU_SUSPEND:  | 
