Re: [PATCH 2/4] kvmtool: ARM: allow level interrupts in device tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 11/12/14 17:15, Will Deacon wrote:
> On Thu, Dec 11, 2014 at 04:30:33PM +0000, Andre Przywara wrote:
>> 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@xxxxxxx>
>> ---
>>  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(-)
> 
> [...]
> 
>> @@ -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..28b0651 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, GIC_FDT_IRQ_FLAGS_EDGE_LO_HI);
> 
> This is a GIC-specific #define in arch-agnostic code. I think we should have
> a new enum type for describing edge and level interrupts, then just use
> that instead.

Right, good point.
I dug a bit in the kernel source, and actually those values behind the
defines are not GIC specific, but are generic IRQ FDT values (used by
other architectures as well). Even the GIC driver source uses these
defines, it's just the GICv3 binding doc that speaks of those specific
numbers.
So if you don't mind, I will remove the GIC_FDT_IRQ_FLAGS_{LEVEL,EDGE}
defines from kvmtool's headers and use the generic defines from the
kernel in one of the fdt headers.

Cheers,
Andre.
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm




[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux