kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
To: Punit Agrawal <punit.agrawal@arm.com>
Cc: kvm@vger.kernel.org, will.deacon@arm.com, robin.murphy@arm.com,
	lorenzo.pieralisi@arm.com, marc.zyngier@arm.com
Subject: Re: [PATCH v2 kvmtool 03/10] irq: add irqfd helpers
Date: Wed, 2 Aug 2017 16:17:59 +0100	[thread overview]
Message-ID: <48e2167f-218d-3074-b65e-97856bec42fa@arm.com> (raw)
In-Reply-To: <87pocgxzhr.fsf@e105922-lin.cambridge.arm.com>

On 31/07/17 18:55, Punit Agrawal wrote:
> Jean-Philippe Brucker <jean-philippe.brucker@arm.com> writes:
> 
>> Add helpers to add and remove IRQFD routing for both irqchips and MSIs.
>> We have to make a special case of IRQ lines on ARM where the
>> initialisation order goes like this:
>>
>>  (1) Devices reserve their IRQ lines
>>  (2) VGIC is setup with VGIC_CTRL_INIT (in a late_init call)
>>  (3) MSIs are reserved lazily, when the guest needs them
>>
>> Since we cannot setup IRQFD before (2), store the IRQFD routing for IRQ
>> lines temporarily until we're ready to submit them.
>>
>> Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
>> ---
>>  arm/gic.c                    | 74 +++++++++++++++++++++++++++++++++++++++++++-
>>  arm/include/arm-common/gic.h |  6 ++++
>>  hw/pci-shmem.c               |  8 +----
>>  include/kvm/irq.h            | 17 ++++++++++
>>  irq.c                        | 24 ++++++++++++++
>>  virtio/net.c                 |  9 ++----
>>  virtio/scsi.c                | 10 ++----
>>  7 files changed, 126 insertions(+), 22 deletions(-)
>>
> 
> [...]
> 
> 
>> diff --git a/arm/include/arm-common/gic.h b/arm/include/arm-common/gic.h
>> index 433dd237..0c279aca 100644
>> --- a/arm/include/arm-common/gic.h
>> +++ b/arm/include/arm-common/gic.h
>> @@ -33,4 +33,10 @@ int gic__alloc_irqnum(void);
>>  int gic__create(struct kvm *kvm, enum irqchip_type type);
>>  void gic__generate_fdt_nodes(void *fdt, enum irqchip_type type);
>>  
>> +int gic__add_irqfd(struct kvm *kvm, unsigned int gsi, int trigger_fd,
>> +		   int resample_fd);
>> +void gic__del_irqfd(struct kvm *kvm, unsigned int gsi, int trigger_fd);
>> +#define irq__add_irqfd gic__add_irqfd
>> +#define irq__del_irqfd gic__del_irqfd
>> +
>>  #endif /* ARM_COMMON__GIC_H */
>> diff --git a/hw/pci-shmem.c b/hw/pci-shmem.c
>> index 512b5b06..107043e9 100644
>> --- a/hw/pci-shmem.c
>> +++ b/hw/pci-shmem.c
>> @@ -127,7 +127,6 @@ static void callback_mmio_msix(struct kvm_cpu *vcpu, u64 addr, u8 *data, u32 len
>>  int pci_shmem__get_local_irqfd(struct kvm *kvm)
>>  {
>>  	int fd, gsi, r;
>> -	struct kvm_irqfd irqfd;
>>  
>>  	if (local_fd == 0) {
>>  		fd = eventfd(0, 0);
>> @@ -143,12 +142,7 @@ int pci_shmem__get_local_irqfd(struct kvm *kvm)
>>  			gsi = pci_shmem_pci_device.irq_line;
>>  		}
>>  
>> -		irqfd = (struct kvm_irqfd) {
>> -			.fd = fd,
>> -			.gsi = gsi,
>> -		};
>> -
>> -		r = ioctl(kvm->vm_fd, KVM_IRQFD, &irqfd);
>> +		r = irq__add_irqfd(kvm, gsi, fd, -1);
>>  		if (r < 0)
>>  			return r;
>>  
> 
> Not something you've introduced but I couldn't find any users of
> pci_shmem__get_local_irqfd(). Could this function be dropped - either as
> a pre-patch or separately?

Heh, indeed. The situation is the same for pci_shmem__add/remove_client. I
suppose it's an interface for another device that has never been added.

Cleaning up pci_shmem is another task altogether. It's not used and there
is no driver upstream. It should probably be removed altogether [1], but I
have enough patches in the pipe right now :)

Thanks,
Jean

[1] https://lists.cs.columbia.edu/pipermail/kvmarm/2015-June/015270.html

  reply	other threads:[~2017-08-02 15:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22 17:05 [PATCH v2 kvmtool 00/10] Add PCI passthrough support with VFIO Jean-Philippe Brucker
2017-06-22 17:05 ` [PATCH v2 kvmtool 01/10] pci: add config operations callbacks on the PCI header Jean-Philippe Brucker
2017-06-22 17:05 ` [PATCH v2 kvmtool 02/10] pci: allow to specify IRQ type for PCI devices Jean-Philippe Brucker
2017-06-22 17:05 ` [PATCH v2 kvmtool 03/10] irq: add irqfd helpers Jean-Philippe Brucker
2017-07-31 17:55   ` Punit Agrawal
2017-08-02 15:17     ` Jean-Philippe Brucker [this message]
2017-06-22 17:05 ` [PATCH v2 kvmtool 04/10] Extend memory bank API with memory types Jean-Philippe Brucker
2017-06-22 17:05 ` [PATCH v2 kvmtool 05/10] pci: add capability helpers Jean-Philippe Brucker
2017-06-22 17:05 ` [PATCH v2 kvmtool 06/10] Add PCI device passthrough using VFIO Jean-Philippe Brucker
2017-07-31 17:52   ` Punit Agrawal
2017-08-02 15:17     ` Jean-Philippe Brucker
2017-08-03  9:36       ` Punit Agrawal
2017-08-03 11:24         ` Jean-Philippe Brucker
2017-06-22 17:05 ` [PATCH v2 kvmtool 07/10] vfio-pci: add MSI-X support Jean-Philippe Brucker
2017-07-31 17:49   ` Punit Agrawal
2017-08-01 16:04     ` Punit Agrawal
2017-08-02 15:18       ` Jean-Philippe Brucker
2017-08-03 10:25         ` Punit Agrawal
2017-08-03 10:53           ` Jean-Philippe Brucker
2017-08-18 17:42   ` Jean-Philippe Brucker
2017-08-22 11:25     ` Punit Agrawal
2017-06-22 17:05 ` [PATCH v2 kvmtool 08/10] vfio-pci: add MSI support Jean-Philippe Brucker
2017-06-22 17:05 ` [PATCH v2 kvmtool 09/10] Introduce reserved memory regions Jean-Philippe Brucker
2017-06-22 17:05 ` [PATCH v2 kvmtool 10/10] vfio: check reserved regions before mapping DMA Jean-Philippe Brucker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48e2167f-218d-3074-b65e-97856bec42fa@arm.com \
    --to=jean-philippe.brucker@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=marc.zyngier@arm.com \
    --cc=punit.agrawal@arm.com \
    --cc=robin.murphy@arm.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).