lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1454358418-5157-6-git-send-email-fu.wei@linaro.org>
Date:	Tue,  2 Feb 2016 04:26:57 +0800
From:	fu.wei@...aro.org
To:	rjw@...ysocki.net, lenb@...nel.org, daniel.lezcano@...aro.org,
	tglx@...utronix.de, christoffer.dall@...aro.org,
	marc.zyngier@....com, gleb@...nel.org, pbonzini@...hat.com,
	hanjun.guo@...aro.org, wei@...hat.com,
	a.spyridakis@...tualopensystems.com
Cc:	linaro-acpi@...ts.linaro.org, linux-kernel@...r.kernel.org,
	linux-acpi@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	kvmarm@...ts.cs.columbia.edu, kvm@...r.kernel.org,
	al.stone@...aro.org, graeme.gregory@...aro.org,
	davem@...emloft.net, jeffrey.t.kirsher@...el.com,
	richardcochran@...il.com, arnd@...db.de, wim@...ana.be,
	jcm@...hat.com, leo.duran@....com, mark.rutland@....com,
	catalin.marinas@....com, will.deacon@....com,
	Suravee.Suthikulpanit@....com, robherring2@...il.com,
	Fu Wei <fu.wei@...aro.org>
Subject: [PATCH v3 5/6] kvm: arm64: wrapping DT support for virt arch timer

From: Wei Huang <wei@...hat.com>

This patches wrapping DT support for virt arch timer into a function.

[Fu Wei: improve the DT support, and separate ACPI support]

Signed-off-by: Alexander Spyridaki <a.spyridakis@...tualopensystems.com>
Signed-off-by: Wei Huang <wei@...hat.com>
Signed-off-by: Graeme Gregory <graeme.gregory@...aro.org>
Signed-off-by: Fu Wei <fu.wei@...aro.org>
---
 virt/kvm/arm/arch_timer.c | 49 +++++++++++++++++++++++++++++++----------------
 1 file changed, 32 insertions(+), 17 deletions(-)

diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index 69bca185..0a279d3 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -381,9 +381,30 @@ static const struct of_device_id arch_timer_of_match[] = {
 	{},
 };
 
-int kvm_timer_hyp_init(void)
+static int kvm_timer_get_ppi(unsigned int *ppi)
 {
 	struct device_node *np;
+	int ret = -EINVAL;
+
+	np = of_find_matching_node(NULL, arch_timer_of_match);
+	if (!np) {
+		ret = -ENODEV;
+		*ppi = 0;
+		goto skip_of;
+	}
+
+	*ppi = irq_of_parse_and_map(np, VIRT_PPI);
+	of_node_put(np);
+
+skip_of:
+	if (*ppi)
+		return 0;
+
+	return ret;
+}
+
+int kvm_timer_hyp_init(void)
+{
 	unsigned int ppi;
 	int err;
 
@@ -391,17 +412,11 @@ int kvm_timer_hyp_init(void)
 	if (!timecounter)
 		return -ENODEV;
 
-	np = of_find_matching_node(NULL, arch_timer_of_match);
-	if (!np) {
-		kvm_err("kvm_arch_timer: can't find DT node\n");
-		return -ENODEV;
-	}
-
-	ppi = irq_of_parse_and_map(np, 2);
-	if (!ppi) {
-		kvm_err("kvm_arch_timer: no virtual timer interrupt\n");
-		err = -EINVAL;
-		goto out;
+	err = kvm_timer_get_ppi(&ppi);
+	if (err) {
+		kvm_err("kvm_arch_timer: can't find virtual timer info or "
+			"config virtual timer interrupt.\n");
+		return err;
 	}
 
 	err = request_percpu_irq(ppi, kvm_arch_timer_handler,
@@ -409,7 +424,7 @@ int kvm_timer_hyp_init(void)
 	if (err) {
 		kvm_err("kvm_arch_timer: can't request interrupt %d (%d)\n",
 			ppi, err);
-		goto out;
+		return err;
 	}
 
 	host_vtimer_irq = ppi;
@@ -426,14 +441,14 @@ int kvm_timer_hyp_init(void)
 		goto out_free;
 	}
 
-	kvm_info("%s IRQ%d\n", np->name, ppi);
+	kvm_info("timer IRQ%d.\n", ppi);
 	on_each_cpu(kvm_timer_init_interrupt, NULL, 1);
 
-	goto out;
+	return 0;
+
 out_free:
 	free_percpu_irq(ppi, kvm_get_running_vcpus());
-out:
-	of_node_put(np);
+
 	return err;
 }
 
-- 
2.5.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ