From: Julien Grall <julien.grall@citrix.com>
To: Ian Campbell <ian.campbell@citrix.com>,
Julien Grall <julien.grall@citrix.com>,
Daniel De Graaf <dgdegra@tycho.nsa.gov>
Cc: xen-devel@lists.xenproject.org, stefano.stabellini@citrix.com,
Julien Grall <julien.grall@linaro.org>,
tim@xen.org, Jan Beulich <jbeulich@suse.com>
Subject: Re: [PATCH v5 p2 04/19] xen/arm: Implement hypercall DOMCTL_{, un}bind_pt_pirq
Date: Thu, 16 Apr 2015 16:20:45 +0100 [thread overview]
Message-ID: <552FD34D.20802@citrix.com> (raw)
In-Reply-To: <1429196139.25195.148.camel@citrix.com>
Hi Ian,
On 16/04/2015 15:55, Ian Campbell wrote:
> On Thu, 2015-04-09 at 16:09 +0100, Julien Grall wrote:
>> From: Julien Grall <julien.grall@linaro.org>
>
> I've left the XSM related quotes untrimmed and CCd Daniel. I think it's
> all code motion (making x86 specific things generic), so perhaps no ack
> needed but an opportunity to nack instead ;-)
>
>> On x86, an IRQ is assigned in 2 steps to an HVM guest:
>> - The toolstack is calling PHYSDEVOP_map_pirq in order to create a
>> guest PIRQ (IRQ bound to an event channel)
>> - The emulator (QEMU) is calling DOMCTL_bind_pt_irq in order to
>> bind the IRQ
>>
>> On ARM, there is no concept of PIRQ as the IRQ can be assigned to a
>> virtual IRQ using the interrupt controller.
>>
>> It's not clear if we will need 2 different hypercalls on ARM to assign
>> IRQ and, for now, only the toolstack will manage IRQ.
>>
>> In order to avoid re-using a fixed ABI hypercall (PHYSDEVOP_*) for a
>> different purpose and allow us more time to figure out the right out,
>> only DOMCTL_{,un}bind_pt_pirq is implemented on ARM.
>>
>> The DOMCTL is extended with a new type PT_IRQ_TYPE_SPI and only IRQ ==
>> vIRQ (i.e machine_irq == spi) is supported.
>>
>> Concerning XSM, even if ARM is using one hypercall rather than 2, the
>> resulting check is nearly the same.
>>
>> XSM PHYSDEVOP_map_pirq:
>> 1) Check if the current domain can add resource to the domain
>> 2) Check if the current domain has permission to add the IRQ
>> 3) Check if the target domain has permission to use the IRQ
>>
>> XSM DOMCTL_bind_pirq_irq:
>> 1) Check if the current domain can add resource to the domain
>> 2) Check if the current domain has permission to bind the IRQ
>> 3) Check if the target domain has permission to use the IRQ
>>
>> In order to keep the same XSM checks done by the 2 hypercalls on x86,
>> call both xsm_map_domain_irq & xsm_bind_pt_irq in the ARM implementation.
>
> I think this paragraph makes the previous bit obsolete?
Do you mean: "Concerning XSM..." until and the 2 paragraphs for XSM
hypercalls? If so, yes.
>
>> diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
>> index 1f2c80c..676ec50 100644
>> --- a/tools/libxc/xc_domain.c
>> +++ b/tools/libxc/xc_domain.c
>> @@ -1773,15 +1773,16 @@ int xc_domain_unbind_msi_irq(
>> }
>>
>> /* Pass-through: binds machine irq to guests irq */
>> -int xc_domain_bind_pt_irq(
>> - xc_interface *xch,
>> - uint32_t domid,
>> - uint8_t machine_irq,
>> - uint8_t irq_type,
>> - uint8_t bus,
>> - uint8_t device,
>> - uint8_t intx,
>> - uint8_t isa_irq)
>> +static int xc_domain_bind_pt_irq_int(
>> + xc_interface *xch,
>> + uint32_t domid,
>> + uint8_t machine_irq,
>> + uint8_t irq_type,
>> + uint8_t bus,
>> + uint8_t device,
>> + uint8_t intx,
>> + uint8_t isa_irq,
>> + uint16_t spi)
>
> Please either leave the indentation of the arguments as it is or fix it
> properly, i.e. put xch on the same line as the prototype and align
> everything else below it.
>
> TBH I'd prefer the former even if it isn't strictly coding style since
> it obscures the real change you made.
Ok. I will do it.
>> @@ -1878,6 +1913,25 @@ int xc_domain_bind_pt_isa_irq(
>> PT_IRQ_TYPE_ISA, 0, 0, 0, machine_irq));
>> }
>>
>> +int xc_domain_bind_pt_spi_irq(
>> + xc_interface *xch,
>> + uint32_t domid,
>> + uint16_t spi)
>> +{
>> + /* vSPI == SPI */
>
> I wonder if to avoid API churn later we should accept both machine and
> guest IRQ here and rely on the check that htey are the same in the
> hypervisor to reject?
>
> Fair enough we can change libxc interface if we want, but avoiding a
> little churn later on seems reasonable and it makes it a better fit with
> the existing interfaces.
what about the following prototype:
int xc_domain_bind_pt_spi_irq(
xc_interface *xch,
uint32_t domid,
uint16_t spi,
uint16_t vspi)
I didn't reuse the current name i.e (machine_irq) because I find the
name confusing.
[..]
>> + case XEN_DOMCTL_unbind_pt_irq:
>> + {
>> + int rc;
>> + xen_domctl_bind_pt_irq_t *bind = &domctl->u.bind_pt_irq;
>> + uint32_t irq = bind->u.spi.spi;
>> + uint32_t virq = bind->machine_irq;
>> +
>> + /* We only support PT_IRQ_TYPE_SPI */
>> + if ( bind->irq_type != PT_IRQ_TYPE_SPI )
>> + return -EOPNOTSUPP;
>> +
>> + /* For now map the interrupt 1:1 */
>> + if ( irq != virq )
>> + return -EINVAL;
>
> The x86 version doesn't appear to consider irq_type or irq, only virq
> (from ->machine_irq). That seems to be logical to me (if a little
> underdocumented) and I think we should be consistent.
On x86, the parameters are used later in pt_create_bind which take the
hypercall data in parameter.
The both check are required in order to avoid future issue if we
introduce new type and when we will support virq != irq.
Regards,
--
Julien Grall
next prev parent reply other threads:[~2015-04-16 15:22 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-09 15:09 [PATCH v5 p2 00/19] xen/arm Add support for non-PCI passthrough Julien Grall
2015-04-09 15:09 ` [PATCH v5 p2 01/19] xen/arm: Let the toolstack configure the number of SPIs Julien Grall
2015-04-16 14:39 ` Ian Campbell
2015-04-16 15:10 ` Julien Grall
2015-04-09 15:09 ` [PATCH v5 p2 02/19] xen/arm: vgic: Add spi_to_pending Julien Grall
2015-04-09 15:09 ` [PATCH v5 p2 03/19] xen/arm: Release IRQ routed to a domain when it's destroying Julien Grall
2015-04-09 15:09 ` [PATCH v5 p2 04/19] xen/arm: Implement hypercall DOMCTL_{, un}bind_pt_pirq Julien Grall
2015-04-16 14:55 ` Ian Campbell
2015-04-16 15:20 ` Julien Grall [this message]
2015-04-16 15:40 ` Ian Campbell
2015-04-17 6:02 ` Julien Grall
2015-04-17 9:47 ` Ian Campbell
2015-04-17 23:05 ` Daniel De Graaf
2015-04-09 15:09 ` [PATCH v5 p2 05/19] xen: guestcopy: Provide an helper to safely copy string from guest Julien Grall
2015-04-09 15:09 ` [PATCH v5 p2 06/19] xen/dts: Provide an helper to get a DT node from a path provided by a guest Julien Grall
2015-04-16 14:57 ` Ian Campbell
2015-04-09 15:09 ` [PATCH v5 p2 07/19] xen/passthrough: Introduce iommu_construct Julien Grall
2015-04-09 15:09 ` [PATCH v5 p2 08/19] xen/passthrough: arm: release the DT devices assigned to a guest earlier Julien Grall
2015-04-09 15:09 ` [PATCH v5 p2 09/19] xen/passthrough: iommu_deassign_device_dt: By default reassign device to nobody Julien Grall
2015-04-09 15:09 ` [PATCH v5 p2 10/19] xen/iommu: arm: Wire iommu DOMCTL for ARM Julien Grall
2015-04-09 15:09 ` [PATCH v5 p2 11/19] xen/xsm: Add helpers to check permission for device tree passthrough Julien Grall
2015-04-09 15:09 ` [PATCH v5 p2 12/19] xen/passthrough: Extend XEN_DOMCTL_*assign_device to support DT device Julien Grall
2015-04-16 15:11 ` Ian Campbell
2015-04-16 15:21 ` Julien Grall
2015-04-09 15:09 ` [PATCH v5 p2 13/19] tools/libxl: Create a per-arch function to map IRQ to a domain Julien Grall
2015-04-16 15:12 ` Ian Campbell
2015-04-16 15:26 ` Julien Grall
2015-04-16 15:42 ` Ian Campbell
2015-04-09 15:09 ` [PATCH v5 p2 14/19] tools/libxl: Check if fdt_{first, next}_subnode are present in libfdt Julien Grall
2015-04-16 15:13 ` Ian Campbell
2015-04-09 15:09 ` [PATCH v5 p2 15/19] tools/(lib)xl: Add partial device tree support for ARM Julien Grall
2015-04-09 16:13 ` Ian Jackson
2015-04-28 13:30 ` Julien Grall
2015-04-16 15:17 ` Ian Campbell
2015-04-09 15:09 ` [PATCH v5 p2 16/19] tools/libxl: arm: Use an higher value for the GIC phandle Julien Grall
2015-04-09 16:17 ` Ian Jackson
2015-04-09 16:33 ` Julien Grall
2015-04-09 16:52 ` Ian Jackson
2015-04-09 17:00 ` Julien Grall
2015-04-09 17:02 ` Julien Grall
2015-04-09 17:04 ` Ian Jackson
2015-04-13 12:07 ` Julien Grall
2015-04-09 15:09 ` [PATCH v5 p2 17/19] libxl: Add support for Device Tree passthrough Julien Grall
2015-04-09 16:14 ` Ian Jackson
2015-04-16 15:19 ` Ian Campbell
2015-04-09 15:09 ` [PATCH v5 p2 18/19] xl: Add new option dtdev Julien Grall
2015-04-09 15:09 ` [PATCH v5 p2 19/19] docs/misc: arm: Add documentation about Device Tree passthrough Julien Grall
2015-04-16 15:20 ` Ian Campbell
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=552FD34D.20802@citrix.com \
--to=julien.grall@citrix.com \
--cc=dgdegra@tycho.nsa.gov \
--cc=ian.campbell@citrix.com \
--cc=jbeulich@suse.com \
--cc=julien.grall@linaro.org \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.