Subject: linux-next: manual merge of the kvm-arm tree with the kvm tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 18 Sep 2014 13:52:26 +1000

Hi all,

Today's linux-next merge of the kvm-arm tree got a conflict in
virt/kvm/arm/vgic.c between commit c06a841bf363 ("KVM: ARM: vgic:
register kvm_device_ops dynamically") from the kvm tree and commit
de56fb1923ca ("KVM: vgic: declare probe function pointer as const")
from the kvm-arm tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    [email-masked]

diff --cc virt/kvm/arm/vgic.c
index 3ee3ce06bbec,efe6eee2e7eb..000000000000
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@@ -1993,81 -2070,3 +1993,81 @@@ static struct kvm_device_ops kvm_arm_vg
  	.get_attr = vgic_get_attr,
  	.has_attr = vgic_has_attr,
  };
 +
 +static void vgic_init_maintenance_interrupt(void *info)
 +{
 +	enable_percpu_irq(vgic->maint_irq, 0);
 +}
 +
 +static int vgic_cpu_notify(struct notifier_block *self,
 +			   unsigned long action, void *cpu)
 +{
 +	switch (action) {
 +	case CPU_STARTING:
 +	case CPU_STARTING_FROZEN:
 +		vgic_init_maintenance_interrupt(NULL);
 +		break;
 +	case CPU_DYING:
 +	case CPU_DYING_FROZEN:
 +		disable_percpu_irq(vgic->maint_irq);
 +		break;
 +	}
 +
 +	return NOTIFY_OK;
 +}
 +
 +static struct notifier_block vgic_cpu_nb = {
 +	.notifier_call = vgic_cpu_notify,
 +};
 +
 +static const struct of_device_id vgic_ids[] = {
 +	{ .compatible = "arm,cortex-a15-gic", .data = vgic_v2_probe, },
 +	{ .compatible = "arm,gic-v3", .data = vgic_v3_probe, },
 +	{},
 +};
 +
 +int kvm_vgic_hyp_init(void)
 +{
 +	const struct of_device_id *matched_id;
- 	int (*vgic_probe)(struct device_node *,const struct vgic_ops **,
++	const int (*vgic_probe)(struct device_node *,const struct vgic_ops **,
 +			  const struct vgic_params **);
 +	struct device_node *vgic_node;
 +	int ret;
 +
 +	vgic_node = of_find_matching_node_and_match(NULL,
 +						    vgic_ids, &matched_id);
 +	if (!vgic_node) {
 +		kvm_err("error: no compatible GIC node found\n");
 +		return -ENODEV;
 +	}
 +
 +	vgic_probe = matched_id->data;
 +	ret = vgic_probe(vgic_node, &vgic_ops, &vgic);
 +	if (ret)
 +		return ret;
 +
 +	ret = request_percpu_irq(vgic->maint_irq, vgic_maintenance_handler,
 +				 "vgic", kvm_get_running_vcpus());
 +	if (ret) {
 +		kvm_err("Cannot register interrupt %d\n", vgic->maint_irq);
 +		return ret;
 +	}
 +
 +	ret = __register_cpu_notifier(&vgic_cpu_nb);
 +	if (ret) {
 +		kvm_err("Cannot register vgic CPU notifier\n");
 +		goto out_free_irq;
 +	}
 +
 +	/* Callback into for arch code for setup */
 +	vgic_arch_setup(vgic);
 +
 +	on_each_cpu(vgic_init_maintenance_interrupt, NULL, 1);
 +
 +	return kvm_register_device_ops(&kvm_arm_vgic_v2_ops,
 +				       KVM_DEV_TYPE_ARM_VGIC_V2);
 +
 +out_free_irq:
 +	free_percpu_irq(vgic->maint_irq, kvm_get_running_vcpus());
 +	return ret;
 +}