[Top][All Lists]

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

[Qemu-devel] Questions regarding ITS implementation

From: Pavel Fedin
Subject: [Qemu-devel] Questions regarding ITS implementation
Date: Wed, 27 May 2015 10:24:23 +0300

 Hello! I am working on GICv3 ITS implementation for qemu and i ran into a 
(big) problem.
I need some advice.
 As far as i can understand from the documentation i have and Linux source 
code, ITS uses
per-device logical IDs as MSI data. These IDs are not global, they are actually 
a relative
IRQ number in IRQ space allocated for the device:
--- cut ---
static inline u32 its_get_event_id(struct irq_data *d)
        struct its_device *its_dev = irq_data_get_irq_chip_data(d);
        return d->hwirq - its_dev->lpi_base;
--- cut ---
 Here d->hwirq is a raw GIC LPI number (they start from 8192) and 
its_dev->lpi_base is a
base LPI number for this device. So, for example, if we have two devices, and 
one of them
uses 4 IRQs and another uses 3 IRQs, we'll have:
 For first device:  hwirq = 8192, lpi_base = 8192 (INT IDs 0 - 3)
 For second device: hwirq = 8196, lpi_base = 8196. (INT IDs 0 - 2)
 So for every device IDs restart from 0, and appear to be duplicated between 
devices. In
order to distinguish between them ITS gets also a thing called device ID, which 
is somehow
hardwired from the PCI bus. Device ID is basically PCI_ID(bus, devfn).
 The first question is: how do i get device ID in qemu ? MSI-X sending function 
in qemu
does only a generic memory write:
--- cut ---
/* Send an MSI-X message */
void msix_notify(PCIDevice *dev, unsigned vector)
    MSIMessage msg;

    if (vector >= dev->msix_entries_nr || !dev->msix_entry_used[vector])
    if (msix_is_masked(dev, vector)) {
        msix_set_pending(dev, vector);

    msg = msix_get_message(dev, vector);

    address_space_stl_le(&dev->bus_master_as, msg.address, msg.data,
                         MEMTXATTRS_UNSPECIFIED, NULL);
--- cut ---
 I do not see anything extra from PCIDevice * going through. I studied APIC 
code, looks
like they encode all the stuff into MSI data.
 Does this mean that qemu currently lacks support for device identifiers in MSI 

Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia

reply via email to

[Prev in Thread] Current Thread [Next in Thread]