Received: from eggs.gnu.org ([2001:4830:134:3::10]:44373)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from
) id 1YxVhX-0005Kd-Oc
for qemu-devel@nongnu.org; Wed, 27 May 2015 03:24:33 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from ) id 1YxVhU-0002S1-IR
for qemu-devel@nongnu.org; Wed, 27 May 2015 03:24:31 -0400
Received: from mailout3.w1.samsung.com ([210.118.77.13]:58481)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from ) id 1YxVhU-0002Rl-Cg
for qemu-devel@nongnu.org; Wed, 27 May 2015 03:24:28 -0400
Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244])
by mailout3.w1.samsung.com
(Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5
2014)) with ESMTP id <0NOZ004LRZ8PUL40@mailout3.w1.samsung.com> for
qemu-devel@nongnu.org; Wed, 27 May 2015 08:24:25 +0100 (BST)
Received: from fedinw7x64 ([106.109.131.169])
by eusync4.samsung.com (Oracle Communications Messaging Server
7.0.5.31.0 64bit (built May 5 2014))
with ESMTPA id <0NOZ00B8WZ8OFW10@eusync4.samsung.com> for
qemu-devel@nongnu.org; Wed, 27 May 2015 08:24:25 +0100 (BST)
From: Pavel Fedin
Date: Wed, 27 May 2015 10:24:23 +0300
Message-id: <00c301d0984e$29004920$7b00db60$@samsung.com>
MIME-version: 1.0
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7bit
Content-language: ru
Subject: [Qemu-devel] Questions regarding ITS implementation
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
To: 'QEMU Developers'
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])
return;
if (msix_is_masked(dev, vector)) {
msix_set_pending(dev, vector);
return;
}
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