* [PATCH v2 0/5] kvmtool: ARM: fixing initrd, serial IRQs and bzImage message
@ 2014-12-17 11:14 Andre Przywara
2014-12-17 11:14 ` [PATCH v2 1/5] kvmtool: ARM: fix initrd functionality Andre Przywara
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Andre Przywara @ 2014-12-17 11:14 UTC (permalink / raw)
To: will.deacon, penberg; +Cc: kvmarm, kvm
This is the fixed version of a part of my kvmtool patch queue.
Patch 1 (fixing initrd for ARM) was already on the list, but hasn't
been merged yet.
Patch 2-4 let kvmtool describe the 8250 serial IRQs as level
triggered and fix a stability problem.
Patch 5 is an easy fix for a message that annoys me every time ;-)
Compared to the last post I inserted a new patch 2/5 to move from the
GIC specific IRQ type defines to generic ones. That should address
Will's comment on the last series.
Cheers,
Andre.
Andre Przywara (5):
kvmtool: ARM: fix initrd functionality
kvmtool: replace GIC specific IRQ type #defines
kvmtool: ARM: allow level interrupts in device tree
kvmtool: ARM: advertise 8250 IRQs as level-triggered
kvmtool: remove warning about bzImage on non-x86 architectures
tools/kvm/arm/fdt.c | 10 +++++-----
tools/kvm/arm/include/arm-common/gic.h | 5 -----
tools/kvm/arm/pci.c | 2 +-
tools/kvm/arm/timer.c | 8 ++++----
tools/kvm/hw/serial.c | 5 +++--
tools/kvm/include/kvm/fdt.h | 9 +++++++++
tools/kvm/include/kvm/ioport.h | 4 +++-
tools/kvm/ioport.c | 6 ++++--
tools/kvm/kvm.c | 5 ++++-
tools/kvm/virtio/mmio.c | 5 +++--
10 files changed, 36 insertions(+), 23 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/5] kvmtool: ARM: fix initrd functionality
2014-12-17 11:14 [PATCH v2 0/5] kvmtool: ARM: fixing initrd, serial IRQs and bzImage message Andre Przywara
@ 2014-12-17 11:14 ` Andre Przywara
2014-12-17 11:14 ` [PATCH v2 2/5] kvmtool: replace GIC specific IRQ type #defines Andre Przywara
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Andre Przywara @ 2014-12-17 11:14 UTC (permalink / raw)
To: will.deacon, penberg; +Cc: kvmarm, kvm
lkvm -i is currently broken on ARM/ARM64.
We should not try to convert smaller-than-4GB addresses into 64-bit
big endian and then stuff them into u32 variables if we expect to read
anything other than 0 out of it.
Adjust the type to u64 to write the proper address in BE format into
the /chosen node (and also match the address size we formely posted)
and let Linux thus read the right values.
This fixes initrd functionality for ARM and ARM64 guests.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
---
tools/kvm/arm/fdt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/kvm/arm/fdt.c b/tools/kvm/arm/fdt.c
index 5626931..4a33846 100644
--- a/tools/kvm/arm/fdt.c
+++ b/tools/kvm/arm/fdt.c
@@ -149,8 +149,8 @@ static int setup_fdt(struct kvm *kvm)
/* Initrd */
if (kvm->arch.initrd_size != 0) {
- u32 ird_st_prop = cpu_to_fdt64(kvm->arch.initrd_guest_start);
- u32 ird_end_prop = cpu_to_fdt64(kvm->arch.initrd_guest_start +
+ u64 ird_st_prop = cpu_to_fdt64(kvm->arch.initrd_guest_start);
+ u64 ird_end_prop = cpu_to_fdt64(kvm->arch.initrd_guest_start +
kvm->arch.initrd_size);
_FDT(fdt_property(fdt, "linux,initrd-start",
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/5] kvmtool: replace GIC specific IRQ type #defines
2014-12-17 11:14 [PATCH v2 0/5] kvmtool: ARM: fixing initrd, serial IRQs and bzImage message Andre Przywara
2014-12-17 11:14 ` [PATCH v2 1/5] kvmtool: ARM: fix initrd functionality Andre Przywara
@ 2014-12-17 11:14 ` Andre Przywara
2014-12-17 11:42 ` Will Deacon
2014-12-17 11:14 ` [PATCH v2 3/5] kvmtool: ARM: allow level interrupts in device tree Andre Przywara
` (2 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Andre Przywara @ 2014-12-17 11:14 UTC (permalink / raw)
To: will.deacon, penberg; +Cc: kvmarm, kvm
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 names in favour of the general
defines used in Linux.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
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 | 9 +++++++++
5 files changed, 15 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..dee9a71 100644
--- a/tools/kvm/include/kvm/fdt.h
+++ b/tools/kvm/include/kvm/fdt.h
@@ -7,6 +7,15 @@
#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.
+ */
+#define IRQ_TYPE_EDGE_RISING 1
+#define IRQ_TYPE_EDGE_FALLING 2
+#define IRQ_TYPE_LEVEL_HIGH 4
+#define IRQ_TYPE_LEVEL_LOW 8
+
/* Helper for the various bits of code that generate FDT nodes */
#define _FDT(exp) \
do { \
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 3/5] kvmtool: ARM: allow level interrupts in device tree
2014-12-17 11:14 [PATCH v2 0/5] kvmtool: ARM: fixing initrd, serial IRQs and bzImage message Andre Przywara
2014-12-17 11:14 ` [PATCH v2 1/5] kvmtool: ARM: fix initrd functionality Andre Przywara
2014-12-17 11:14 ` [PATCH v2 2/5] kvmtool: replace GIC specific IRQ type #defines Andre Przywara
@ 2014-12-17 11:14 ` Andre Przywara
2014-12-17 11:14 ` [PATCH v2 4/5] kvmtool: ARM: advertise 8250 IRQs as level-triggered Andre Przywara
2014-12-17 11:14 ` [PATCH v2 5/5] kvmtool: remove warning about bzImage on non-x86 architectures Andre Przywara
4 siblings, 0 replies; 8+ messages in thread
From: Andre Przywara @ 2014-12-17 11:14 UTC (permalink / raw)
To: will.deacon, penberg; +Cc: kvmarm, kvm
Currently we describe every interrupt for each device in the FDT
as being edge triggered.
Add a parameter to the irq property generation to allow devices to
specify their interrupts as level triggered if needed.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
tools/kvm/arm/fdt.c | 6 +++---
tools/kvm/hw/serial.c | 5 +++--
tools/kvm/include/kvm/ioport.h | 4 +++-
tools/kvm/ioport.c | 6 ++++--
tools/kvm/virtio/mmio.c | 5 +++--
5 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/tools/kvm/arm/fdt.c b/tools/kvm/arm/fdt.c
index 24f030f..918d89f 100644
--- a/tools/kvm/arm/fdt.c
+++ b/tools/kvm/arm/fdt.c
@@ -74,12 +74,12 @@ static void generate_cpu_nodes(void *fdt, struct kvm *kvm)
_FDT(fdt_end_node(fdt));
}
-static void generate_irq_prop(void *fdt, u8 irq)
+static void generate_irq_prop(void *fdt, u8 irq, u32 irq_type)
{
u32 irq_prop[] = {
cpu_to_fdt32(GIC_FDT_IRQ_TYPE_SPI),
cpu_to_fdt32(irq - GIC_SPI_IRQ_BASE),
- cpu_to_fdt32(IRQ_TYPE_EDGE_RISING),
+ cpu_to_fdt32(irq_type)
};
_FDT(fdt_property(fdt, "interrupts", irq_prop, sizeof(irq_prop)));
@@ -127,7 +127,7 @@ static int setup_fdt(struct kvm *kvm)
void *fdt_dest = guest_flat_to_host(kvm,
kvm->arch.dtb_guest_start);
void (*generate_mmio_fdt_nodes)(void *, struct device_header *,
- void (*)(void *, u8));
+ void (*)(void *, u8, u32));
void (*generate_cpu_peripheral_fdt_nodes)(void *, struct kvm *, u32)
= kvm->cpus[0]->generate_fdt_nodes;
diff --git a/tools/kvm/hw/serial.c b/tools/kvm/hw/serial.c
index 60147de..37bcd28 100644
--- a/tools/kvm/hw/serial.c
+++ b/tools/kvm/hw/serial.c
@@ -369,7 +369,8 @@ static bool serial8250_in(struct ioport *ioport, struct kvm_cpu *vcpu, u16 port,
#define DEVICE_NAME_MAX_LEN 32
static void serial8250_generate_fdt_node(struct ioport *ioport, void *fdt,
void (*generate_irq_prop)(void *fdt,
- u8 irq))
+ u8 irq,
+ u32 type))
{
char dev_name[DEVICE_NAME_MAX_LEN];
struct serial8250_device *dev = ioport->priv;
@@ -384,7 +385,7 @@ static void serial8250_generate_fdt_node(struct ioport *ioport, void *fdt,
_FDT(fdt_begin_node(fdt, dev_name));
_FDT(fdt_property_string(fdt, "compatible", "ns16550a"));
_FDT(fdt_property(fdt, "reg", reg_prop, sizeof(reg_prop)));
- generate_irq_prop(fdt, dev->irq);
+ generate_irq_prop(fdt, dev->irq, IRQ_TYPE_EDGE_RISING);
_FDT(fdt_property_cell(fdt, "clock-frequency", 1843200));
_FDT(fdt_end_node(fdt));
}
diff --git a/tools/kvm/include/kvm/ioport.h b/tools/kvm/include/kvm/ioport.h
index 18da47c..ffd938d 100644
--- a/tools/kvm/include/kvm/ioport.h
+++ b/tools/kvm/include/kvm/ioport.h
@@ -31,7 +31,9 @@ struct ioport_operations {
bool (*io_in)(struct ioport *ioport, struct kvm_cpu *vcpu, u16 port, void *data, int size);
bool (*io_out)(struct ioport *ioport, struct kvm_cpu *vcpu, u16 port, void *data, int size);
void (*generate_fdt_node)(struct ioport *ioport, void *fdt,
- void (*generate_irq_prop)(void *fdt, u8 irq));
+ void (*generate_irq_prop)(void *fdt,
+ u8 irq,
+ u32 irq_type));
};
void ioport__setup_arch(struct kvm *kvm);
diff --git a/tools/kvm/ioport.c b/tools/kvm/ioport.c
index 5bfb7e2..b507cab 100644
--- a/tools/kvm/ioport.c
+++ b/tools/kvm/ioport.c
@@ -59,7 +59,8 @@ static void ioport_remove(struct rb_root *root, struct ioport *data)
static void generate_ioport_fdt_node(void *fdt,
struct device_header *dev_hdr,
void (*generate_irq_prop)(void *fdt,
- u8 irq))
+ u8 irq,
+ u32 irq_type))
{
struct ioport *ioport = container_of(dev_hdr, struct ioport, dev_hdr);
struct ioport_operations *ops = ioport->ops;
@@ -71,7 +72,8 @@ static void generate_ioport_fdt_node(void *fdt,
static void generate_ioport_fdt_node(void *fdt,
struct device_header *dev_hdr,
void (*generate_irq_prop)(void *fdt,
- u8 irq))
+ u8 irq,
+ u32 irq_type))
{
die("Unable to generate device tree nodes without libfdt\n");
}
diff --git a/tools/kvm/virtio/mmio.c b/tools/kvm/virtio/mmio.c
index 3a2bd62..1b2fa25 100644
--- a/tools/kvm/virtio/mmio.c
+++ b/tools/kvm/virtio/mmio.c
@@ -233,7 +233,8 @@ static void virtio_mmio_mmio_callback(struct kvm_cpu *vcpu,
static void generate_virtio_mmio_fdt_node(void *fdt,
struct device_header *dev_hdr,
void (*generate_irq_prop)(void *fdt,
- u8 irq))
+ u8 irq,
+ u32 type))
{
char dev_name[DEVICE_NAME_MAX_LEN];
struct virtio_mmio *vmmio = container_of(dev_hdr,
@@ -250,7 +251,7 @@ static void generate_virtio_mmio_fdt_node(void *fdt,
_FDT(fdt_begin_node(fdt, dev_name));
_FDT(fdt_property_string(fdt, "compatible", "virtio,mmio"));
_FDT(fdt_property(fdt, "reg", reg_prop, sizeof(reg_prop)));
- generate_irq_prop(fdt, vmmio->irq);
+ generate_irq_prop(fdt, vmmio->irq, IRQ_TYPE_EDGE_RISING);
_FDT(fdt_end_node(fdt));
}
#else
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 4/5] kvmtool: ARM: advertise 8250 IRQs as level-triggered
2014-12-17 11:14 [PATCH v2 0/5] kvmtool: ARM: fixing initrd, serial IRQs and bzImage message Andre Przywara
` (2 preceding siblings ...)
2014-12-17 11:14 ` [PATCH v2 3/5] kvmtool: ARM: allow level interrupts in device tree Andre Przywara
@ 2014-12-17 11:14 ` Andre Przywara
2014-12-17 11:14 ` [PATCH v2 5/5] kvmtool: remove warning about bzImage on non-x86 architectures Andre Przywara
4 siblings, 0 replies; 8+ messages in thread
From: Andre Przywara @ 2014-12-17 11:14 UTC (permalink / raw)
To: will.deacon, penberg; +Cc: kvmarm, kvm
Both the 16550/8250 UART emulation in kvmtool as well as all the
drivers and DTBs for real hardware use level triggered interrutpts.
But the device tree currently describes them as being edge triggered,
which can lead to hangs in guests.
Use the new IRQ type parameter to properly describe the interrupts.
This goes along the lines of a similar QEMU patch:
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=0be969a2d974971628fc4ed95834d22ecf0fd497
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
tools/kvm/hw/serial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/kvm/hw/serial.c b/tools/kvm/hw/serial.c
index 37bcd28..8814afe 100644
--- a/tools/kvm/hw/serial.c
+++ b/tools/kvm/hw/serial.c
@@ -385,7 +385,7 @@ static void serial8250_generate_fdt_node(struct ioport *ioport, void *fdt,
_FDT(fdt_begin_node(fdt, dev_name));
_FDT(fdt_property_string(fdt, "compatible", "ns16550a"));
_FDT(fdt_property(fdt, "reg", reg_prop, sizeof(reg_prop)));
- generate_irq_prop(fdt, dev->irq, IRQ_TYPE_EDGE_RISING);
+ generate_irq_prop(fdt, dev->irq, IRQ_TYPE_LEVEL_HIGH);
_FDT(fdt_property_cell(fdt, "clock-frequency", 1843200));
_FDT(fdt_end_node(fdt));
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 5/5] kvmtool: remove warning about bzImage on non-x86 architectures
2014-12-17 11:14 [PATCH v2 0/5] kvmtool: ARM: fixing initrd, serial IRQs and bzImage message Andre Przywara
` (3 preceding siblings ...)
2014-12-17 11:14 ` [PATCH v2 4/5] kvmtool: ARM: advertise 8250 IRQs as level-triggered Andre Przywara
@ 2014-12-17 11:14 ` Andre Przywara
2014-12-17 11:43 ` Will Deacon
4 siblings, 1 reply; 8+ messages in thread
From: Andre Przywara @ 2014-12-17 11:14 UTC (permalink / raw)
To: will.deacon, penberg; +Cc: kvmarm, kvm
Among the architectures supported by kvmtool, only x86 defines a
bzImage format. So we shouldn't bother users of other architectures
with a message about something that cannot work.
Make the bzImage check dependent on compiling for x86.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
tools/kvm/kvm.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c
index e1b9f6c..21817c3 100644
--- a/tools/kvm/kvm.c
+++ b/tools/kvm/kvm.c
@@ -380,12 +380,15 @@ bool kvm__load_kernel(struct kvm *kvm, const char *kernel_filename,
die("%s is not an initrd", initrd_filename);
}
+#ifdef CONFIG_X86
ret = load_bzimage(kvm, fd_kernel, fd_initrd, kernel_cmdline);
if (ret)
goto found_kernel;
- pr_warning("%s is not a bzImage. Trying to load it as a flat binary...", kernel_filename);
+ pr_warning("%s is not a bzImage. Trying to load it as an ELF or flat binary...",
+ kernel_filename);
+#endif
ret = load_elf_binary(kvm, fd_kernel, fd_initrd, kernel_cmdline);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/5] kvmtool: replace GIC specific IRQ type #defines
2014-12-17 11:14 ` [PATCH v2 2/5] kvmtool: replace GIC specific IRQ type #defines Andre Przywara
@ 2014-12-17 11:42 ` Will Deacon
0 siblings, 0 replies; 8+ messages in thread
From: Will Deacon @ 2014-12-17 11:42 UTC (permalink / raw)
To: Andre Przywara
Cc: penberg@kernel.org, kvmarm@lists.cs.columbia.edu,
kvm@vger.kernel.org
On Wed, Dec 17, 2014 at 11:14:44AM +0000, Andre Przywara wrote:
> 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 names in favour of the general
> defines used in Linux.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
> 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 | 9 +++++++++
> 5 files changed, 15 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..dee9a71 100644
> --- a/tools/kvm/include/kvm/fdt.h
> +++ b/tools/kvm/include/kvm/fdt.h
> @@ -7,6 +7,15 @@
>
> #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.
> + */
> +#define IRQ_TYPE_EDGE_RISING 1
> +#define IRQ_TYPE_EDGE_FALLING 2
> +#define IRQ_TYPE_LEVEL_HIGH 4
> +#define IRQ_TYPE_LEVEL_LOW 8
Any chance we can keep this as an enum, please? That matches that the kernel
uses internally, and allows you to take a specific type instead of a u32
for the device-tree generating functions.
Will
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 5/5] kvmtool: remove warning about bzImage on non-x86 architectures
2014-12-17 11:14 ` [PATCH v2 5/5] kvmtool: remove warning about bzImage on non-x86 architectures Andre Przywara
@ 2014-12-17 11:43 ` Will Deacon
0 siblings, 0 replies; 8+ messages in thread
From: Will Deacon @ 2014-12-17 11:43 UTC (permalink / raw)
To: Andre Przywara
Cc: penberg@kernel.org, kvmarm@lists.cs.columbia.edu,
kvm@vger.kernel.org
On Wed, Dec 17, 2014 at 11:14:47AM +0000, Andre Przywara wrote:
> Among the architectures supported by kvmtool, only x86 defines a
> bzImage format. So we shouldn't bother users of other architectures
> with a message about something that cannot work.
> Make the bzImage check dependent on compiling for x86.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
> tools/kvm/kvm.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c
> index e1b9f6c..21817c3 100644
> --- a/tools/kvm/kvm.c
> +++ b/tools/kvm/kvm.c
> @@ -380,12 +380,15 @@ bool kvm__load_kernel(struct kvm *kvm, const char *kernel_filename,
> die("%s is not an initrd", initrd_filename);
> }
>
> +#ifdef CONFIG_X86
> ret = load_bzimage(kvm, fd_kernel, fd_initrd, kernel_cmdline);
>
> if (ret)
> goto found_kernel;
>
> - pr_warning("%s is not a bzImage. Trying to load it as a flat binary...", kernel_filename);
> + pr_warning("%s is not a bzImage. Trying to load it as an ELF or flat binary...",
> + kernel_filename);
> +#endif
I don't think you need to change the string (at least, that seems to be an
unrelated change).
Will
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-12-17 11:43 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-17 11:14 [PATCH v2 0/5] kvmtool: ARM: fixing initrd, serial IRQs and bzImage message Andre Przywara
2014-12-17 11:14 ` [PATCH v2 1/5] kvmtool: ARM: fix initrd functionality Andre Przywara
2014-12-17 11:14 ` [PATCH v2 2/5] kvmtool: replace GIC specific IRQ type #defines Andre Przywara
2014-12-17 11:42 ` Will Deacon
2014-12-17 11:14 ` [PATCH v2 3/5] kvmtool: ARM: allow level interrupts in device tree Andre Przywara
2014-12-17 11:14 ` [PATCH v2 4/5] kvmtool: ARM: advertise 8250 IRQs as level-triggered Andre Przywara
2014-12-17 11:14 ` [PATCH v2 5/5] kvmtool: remove warning about bzImage on non-x86 architectures Andre Przywara
2014-12-17 11:43 ` Will Deacon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox