All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: Stewart Hildebrand <stewart.hildebrand@dornerworks.com>
Cc: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	xen-devel@lists.xenproject.org,
	Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	Ian Campbell <ian.campbell@citrix.com>
Subject: Re: [Xen-devel] [XEN PATCH v3 05/11] xen: arm: add interfaces to save/restore the state of a PPI.
Date: Tue, 26 Nov 2019 15:15:58 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1911261356290.8205@sstabellini-ThinkPad-T480s> (raw)
In-Reply-To: <20191115201037.44982-1-stewart.hildebrand@dornerworks.com>

On Fri, 15 Nov 2019, Stewart Hildebrand wrote:
> diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
> index f3f3fb7d7f..c3f4cd5069 100644
> --- a/xen/include/asm-arm/domain.h
> +++ b/xen/include/asm-arm/domain.h
> @@ -34,6 +34,17 @@ enum domain_type {
>  /* The hardware domain has always its memory direct mapped. */
>  #define is_domain_direct_mapped(d) ((d) == hardware_domain)
>  
> +struct hwppi_state {
> +    /* h/w state */
> +    unsigned irq;

It doesn't look like we need to save the irq number again here.


> +    unsigned long enabled:1;
> +    unsigned long pending:1;
> +    unsigned long active:1;
> +
> +    /* Xen s/w state */
> +    unsigned long inprogress:1;
> +};
> +
>  struct vtimer {
>      struct vcpu *v;
>      int irq;
> diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
> index 793d324b33..1164e0c7a6 100644
> --- a/xen/include/asm-arm/gic.h
> +++ b/xen/include/asm-arm/gic.h
> @@ -275,6 +275,26 @@ extern int gicv_setup(struct domain *d);
>  extern void gic_save_state(struct vcpu *v);
>  extern void gic_restore_state(struct vcpu *v);
>  
> +/*
> + * Save/restore the state of a single PPI which must be routed to
> + * <current-vcpu> (that is, is defined to be injected to the current
> + * vcpu).
> + *
> + * We expect the device which use this PPI to be quiet while we
> + * save/restore.
> + *
> + * For instance we want to disable the timer before saving the state.
> + * Otherwise we will mess up the state.
> + */
> +struct hwppi_state;

It is a bit awkward to have to do this "redefine" struct hwppi_state
here. I know that the Xen headers file don't always include correctly,
but could we move the full definition of struct hwppi_state here?
domain.h is already including gic.h, so it should work?


> +extern void gic_hwppi_state_init(struct hwppi_state *s, unsigned irq);
> +extern void gic_hwppi_set_pending(struct hwppi_state *s);
> +extern void gic_save_and_mask_hwppi(struct vcpu *v, unsigned irq,
> +                                    struct hwppi_state *s);
> +extern void gic_restore_hwppi(struct vcpu *v,
> +                              const unsigned virq,
> +                              const struct hwppi_state *s);
> +
>  /* SGI (AKA IPIs) */
>  enum gic_sgi {
>      GIC_SGI_EVENT_CHECK = 0,
> @@ -325,8 +345,10 @@ struct gic_hw_operations {
>      int (*init)(void);
>      /* Save GIC registers */
>      void (*save_state)(struct vcpu *);
> +    void (*save_and_mask_hwppi)(struct irq_desc *desc, struct hwppi_state *s);
>      /* Restore GIC registers */
>      void (*restore_state)(const struct vcpu *);
> +    void (*restore_hwppi)(struct irq_desc *desc, const struct hwppi_state *s);
>      /* Dump GIC LR register information */
>      void (*dump_state)(const struct vcpu *);
>  
> diff --git a/xen/include/asm-arm/irq.h b/xen/include/asm-arm/irq.h
> index e14001b5c6..3b37a21c06 100644
> --- a/xen/include/asm-arm/irq.h
> +++ b/xen/include/asm-arm/irq.h
> @@ -96,6 +96,8 @@ void irq_set_affinity(struct irq_desc *desc, const cpumask_t *cpu_mask);
>   */
>  bool irq_type_set_by_domain(const struct domain *d);
>  
> +void irq_set_virq(struct irq_desc *desc, unsigned virq);
> +
>  #endif /* _ASM_HW_IRQ_H */
>  /*
>   * Local variables:

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-11-26 23:16 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-15 20:01 [Xen-devel] [XEN PATCH v3 00/11] xen: arm: context switch vtimer PPI state Stewart Hildebrand
2019-11-15 20:01 ` [Xen-devel] [XEN PATCH v3 01/11] xen: arm: fix indentation of struct vtimer Stewart Hildebrand
2019-11-23 18:40   ` Julien Grall
2019-11-23 18:45     ` Julien Grall
2019-11-15 20:01 ` [Xen-devel] [XEN PATCH v3 02/11] xen: arm: fix typo in the description of struct pending_irq->desc Stewart Hildebrand
2019-11-23 18:47   ` Julien Grall
2019-11-15 20:01 ` [Xen-devel] [XEN PATCH v3 03/11] xen: arm: Refactor route_irq_to_guest Stewart Hildebrand
2019-11-23 19:21   ` Julien Grall
2019-11-15 20:01 ` [Xen-devel] [XEN PATCH v3 04/11] xen: arm: remove is_assignable_irq Stewart Hildebrand
2019-11-23 19:28   ` Julien Grall
2019-11-15 20:10 ` [Xen-devel] [XEN PATCH v3 05/11] xen: arm: add interfaces to save/restore the state of a PPI Stewart Hildebrand
2019-11-17 23:10   ` Stewart Hildebrand
2019-11-25 21:23   ` Julien Grall
2019-11-26 23:15   ` Stefano Stabellini [this message]
2019-11-15 20:10 ` [Xen-devel] [XEN PATCH v3 06/11] Add NR_SGIS and NR_PPIS definitions to irq.h Stewart Hildebrand
2019-11-27 17:49   ` Julien Grall
2019-11-15 20:10 ` [Xen-devel] [XEN PATCH v3 07/11] xen: arm: vgic: allow delivery of PPIs to guests Stewart Hildebrand
2019-11-23 20:35   ` Julien Grall
2019-11-25 15:05     ` Julien Grall
2019-11-26  1:20       ` Stefano Stabellini
2019-11-26 13:58         ` Julien Grall
2019-11-26 22:36       ` Stefano Stabellini
2019-11-26 22:42         ` Julien Grall
2019-11-27 18:48           ` Stefano Stabellini
2019-11-27 19:17             ` Julien Grall
2019-11-26 23:16   ` Stefano Stabellini
2019-11-27  0:13     ` Julien Grall
2019-11-28  1:07       ` Stefano Stabellini
2019-11-28  9:53         ` Julien Grall
2019-11-15 20:10 ` [Xen-devel] [RFC XEN PATCH v3 08/11] xen: arm: vgic: don't fail if IRQ is already connected Stewart Hildebrand
2019-11-26 23:16   ` Stefano Stabellini
2019-12-03 14:24   ` Julien Grall
2019-11-15 20:10 ` [Xen-devel] [XEN PATCH v3 09/11] xen: arm: gic: supporting routing a PPI to the current vcpu Stewart Hildebrand
2019-11-17 23:11   ` Stewart Hildebrand
2019-11-15 20:14 ` [Xen-devel] [RFC XEN PATCH v3 10/11] xen: arm: context switch vtimer PPI state Stewart Hildebrand
2019-11-25 21:55   ` Julien Grall
2019-11-26 23:16     ` Stefano Stabellini
2019-11-15 20:14 ` [Xen-devel] [HACK XEN PATCH v3 11/11] HACK: Force virt timer to PPI0 (IRQ16) Stewart Hildebrand

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=alpine.DEB.2.21.1911261356290.8205@sstabellini-ThinkPad-T480s \
    --to=sstabellini@kernel.org \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=ian.campbell@citrix.com \
    --cc=julien@xen.org \
    --cc=stewart.hildebrand@dornerworks.com \
    --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.