From patchwork Wed Dec 17 15:40:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 5507451 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7A35ABEEA8 for ; Wed, 17 Dec 2014 15:40:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A35C020A27 for ; Wed, 17 Dec 2014 15:40:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9EA7120A25 for ; Wed, 17 Dec 2014 15:40:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751035AbaLQPkp (ORCPT ); Wed, 17 Dec 2014 10:40:45 -0500 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:50533 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750976AbaLQPko (ORCPT ); Wed, 17 Dec 2014 10:40:44 -0500 Received: from e106785-lin.cambridge.arm.com ([10.1.203.45]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id sBHFebwq003928; Wed, 17 Dec 2014 15:40:37 GMT From: Andre Przywara To: will.deacon@arm.com, penberg@kernel.org Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH v3 2/5] kvmtool: replace GIC specific IRQ type #defines Date: Wed, 17 Dec 2014 15:40:45 +0000 Message-Id: <1418830848-1463-3-git-send-email-andre.przywara@arm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1418830848-1463-1-git-send-email-andre.przywara@arm.com> References: <1418830848-1463-1-git-send-email-andre.przywara@arm.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We had GIC specific defines for the IRQ type identifiers in kvmtool. But in fact the specification of being a level or edge interrupt is quite generic, with the GIC binding using the generic Linux defines. So lets replace the GIC specific #defines in favour of the more general names copied from Linux' include/linux/irq.h. Signed-off-by: Andre Przywara --- tools/kvm/arm/fdt.c | 2 +- tools/kvm/arm/include/arm-common/gic.h | 5 ----- tools/kvm/arm/pci.c | 2 +- tools/kvm/arm/timer.c | 8 ++++---- tools/kvm/include/kvm/fdt.h | 14 ++++++++++++++ 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/tools/kvm/arm/fdt.c b/tools/kvm/arm/fdt.c index 4a33846..24f030f 100644 --- a/tools/kvm/arm/fdt.c +++ b/tools/kvm/arm/fdt.c @@ -79,7 +79,7 @@ static void generate_irq_prop(void *fdt, u8 irq) u32 irq_prop[] = { cpu_to_fdt32(GIC_FDT_IRQ_TYPE_SPI), cpu_to_fdt32(irq - GIC_SPI_IRQ_BASE), - cpu_to_fdt32(GIC_FDT_IRQ_FLAGS_EDGE_LO_HI), + cpu_to_fdt32(IRQ_TYPE_EDGE_RISING), }; _FDT(fdt_property(fdt, "interrupts", irq_prop, sizeof(irq_prop))); diff --git a/tools/kvm/arm/include/arm-common/gic.h b/tools/kvm/arm/include/arm-common/gic.h index 850edc7..5a36f2c 100644 --- a/tools/kvm/arm/include/arm-common/gic.h +++ b/tools/kvm/arm/include/arm-common/gic.h @@ -10,11 +10,6 @@ #define GIC_FDT_IRQ_TYPE_SPI 0 #define GIC_FDT_IRQ_TYPE_PPI 1 -#define GIC_FDT_IRQ_FLAGS_EDGE_LO_HI 1 -#define GIC_FDT_IRQ_FLAGS_EDGE_HI_LO 2 -#define GIC_FDT_IRQ_FLAGS_LEVEL_HI 4 -#define GIC_FDT_IRQ_FLAGS_LEVEL_LO 8 - #define GIC_FDT_IRQ_PPI_CPU_SHIFT 8 #define GIC_FDT_IRQ_PPI_CPU_MASK (0xff << GIC_FDT_IRQ_PPI_CPU_SHIFT) diff --git a/tools/kvm/arm/pci.c b/tools/kvm/arm/pci.c index 9f4dabc..99a8130 100644 --- a/tools/kvm/arm/pci.c +++ b/tools/kvm/arm/pci.c @@ -87,7 +87,7 @@ void pci__generate_fdt_nodes(void *fdt, u32 gic_phandle) .gic_irq = { .type = cpu_to_fdt32(GIC_FDT_IRQ_TYPE_SPI), .num = cpu_to_fdt32(irq - GIC_SPI_IRQ_BASE), - .flags = cpu_to_fdt32(GIC_FDT_IRQ_FLAGS_EDGE_LO_HI), + .flags = cpu_to_fdt32(IRQ_TYPE_EDGE_RISING), }, }; diff --git a/tools/kvm/arm/timer.c b/tools/kvm/arm/timer.c index 209251e..29991da 100644 --- a/tools/kvm/arm/timer.c +++ b/tools/kvm/arm/timer.c @@ -15,19 +15,19 @@ void timer__generate_fdt_nodes(void *fdt, struct kvm *kvm, int *irqs) u32 irq_prop[] = { cpu_to_fdt32(GIC_FDT_IRQ_TYPE_PPI), cpu_to_fdt32(irqs[0]), - cpu_to_fdt32(cpu_mask | GIC_FDT_IRQ_FLAGS_EDGE_LO_HI), + cpu_to_fdt32(cpu_mask | IRQ_TYPE_EDGE_RISING), cpu_to_fdt32(GIC_FDT_IRQ_TYPE_PPI), cpu_to_fdt32(irqs[1]), - cpu_to_fdt32(cpu_mask | GIC_FDT_IRQ_FLAGS_EDGE_LO_HI), + cpu_to_fdt32(cpu_mask | IRQ_TYPE_EDGE_RISING), cpu_to_fdt32(GIC_FDT_IRQ_TYPE_PPI), cpu_to_fdt32(irqs[2]), - cpu_to_fdt32(cpu_mask | GIC_FDT_IRQ_FLAGS_EDGE_LO_HI), + cpu_to_fdt32(cpu_mask | IRQ_TYPE_EDGE_RISING), cpu_to_fdt32(GIC_FDT_IRQ_TYPE_PPI), cpu_to_fdt32(irqs[3]), - cpu_to_fdt32(cpu_mask | GIC_FDT_IRQ_FLAGS_EDGE_LO_HI), + cpu_to_fdt32(cpu_mask | IRQ_TYPE_EDGE_RISING), }; _FDT(fdt_begin_node(fdt, "timer")); diff --git a/tools/kvm/include/kvm/fdt.h b/tools/kvm/include/kvm/fdt.h index 19f95ac..5542728 100644 --- a/tools/kvm/include/kvm/fdt.h +++ b/tools/kvm/include/kvm/fdt.h @@ -7,6 +7,20 @@ #define FDT_MAX_SIZE 0x10000 +/* Those definitions are generic FDT values for specifying IRQ + * types and are used in the Linux kernel internally as well as in + * the dts files and their documentation. + */ +enum irq_type { + IRQ_TYPE_NONE = 0x00000000, + IRQ_TYPE_EDGE_RISING = 0x00000001, + IRQ_TYPE_EDGE_FALLING = 0x00000002, + IRQ_TYPE_EDGE_BOTH = (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING), + IRQ_TYPE_LEVEL_HIGH = 0x00000004, + IRQ_TYPE_LEVEL_LOW = 0x00000008, + IRQ_TYPE_LEVEL_MASK = (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH), +}; + /* Helper for the various bits of code that generate FDT nodes */ #define _FDT(exp) \ do { \