All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Anthony PERARD <anthony.perard@citrix.com>
Cc: EDK2 devel <edk2-devel@lists.sourceforge.net>,
	Xen Devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH v2 15/18] OvmfPkg/XenBusDxe: Add Event Channel into XenBus protocol.
Date: Fri, 12 Sep 2014 09:58:53 -0400	[thread overview]
Message-ID: <20140912135853.GA14467@laptop.dumpdata.com> (raw)
In-Reply-To: <1409849473-9268-16-git-send-email-anthony.perard@citrix.com>

On Thu, Sep 04, 2014 at 05:51:10PM +0100, Anthony PERARD wrote:
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

While the code is fine, please expand the description here a bit.

You can even just copy and paste the function comments - and
start it with: "Adding three event channel related functions:
a) Allocate (copy-n-paste of the oneline from the function
   comment).
b) Notify..

and so on.

Thank you.
> 
> ---
> Change in V2:
> - coding style
> - adding comment to functions
> - Rename Xenbus to XenBus.
> ---
>  OvmfPkg/Include/Protocol/XenBus.h | 27 +++++++++++++++++++
>  OvmfPkg/XenBusDxe/EventChannel.c  | 55 +++++++++++++++++++++++++++++++++++++++
>  OvmfPkg/XenBusDxe/EventChannel.h  | 48 ++++++++++++++++++++++++++++++++++
>  OvmfPkg/XenBusDxe/XenBus.c        |  3 +++
>  4 files changed, 133 insertions(+)
> 
> diff --git a/OvmfPkg/Include/Protocol/XenBus.h b/OvmfPkg/Include/Protocol/XenBus.h
> index f223be7..f404a81 100644
> --- a/OvmfPkg/Include/Protocol/XenBus.h
> +++ b/OvmfPkg/Include/Protocol/XenBus.h
> @@ -76,6 +76,7 @@ typedef enum {
>  
>  
>  #include <IndustryStandard/Xen/grant_table.h>
> +#include <IndustryStandard/Xen/event_channel.h>
>  
>  ///
>  /// Function prototypes
> @@ -163,6 +164,28 @@ EFI_STATUS
>    );
>  
>  typedef
> +UINT32
> +(EFIAPI *XENBUS_EVENT_CHANNEL_ALLOCATE) (
> +  IN  XENBUS_PROTOCOL *This,
> +  IN  domid_t         DomainId,
> +  OUT evtchn_port_t   *Port
> +  );
> +
> +typedef
> +VOID
> +(EFIAPI *XENBUS_EVENT_CHANNEL_NOTIFY) (
> +  IN XENBUS_PROTOCOL  *This,
> +  IN evtchn_port_t    Port
> +  );
> +
> +typedef
> +UINT32
> +(EFIAPI *XENBUS_EVENT_CHANNEL_CLOSE) (
> +  IN XENBUS_PROTOCOL  *This,
> +  IN evtchn_port_t    Port
> +  );
> +
> +typedef
>  XENSTORE_STATUS
>  (EFIAPI *XENBUS_REGISTER_WATCH) (
>    IN  XENBUS_PROTOCOL *This,
> @@ -209,6 +232,10 @@ struct _XENBUS_PROTOCOL {
>    XENBUS_GRANT_ACCESS           GrantAccess;
>    XENBUS_GRANT_END_ACCESS       GrantEndAccess;
>  
> +  XENBUS_EVENT_CHANNEL_ALLOCATE EventChannelAllocate;
> +  XENBUS_EVENT_CHANNEL_NOTIFY   EventChannelNotify;
> +  XENBUS_EVENT_CHANNEL_CLOSE    EventChannelClose;
> +
>    XENBUS_REGISTER_WATCH         RegisterWatch;
>    XENBUS_REGISTER_WATCH_BACKEND RegisterWatchBackend;
>    XENBUS_UNREGISTER_WATCH       UnregisterWatch;
> diff --git a/OvmfPkg/XenBusDxe/EventChannel.c b/OvmfPkg/XenBusDxe/EventChannel.c
> index f34f9b8..82c4f4b 100644
> --- a/OvmfPkg/XenBusDxe/EventChannel.c
> +++ b/OvmfPkg/XenBusDxe/EventChannel.c
> @@ -47,3 +47,58 @@ XenEventChannelNotify (
>    ReturnCode = XenHypercallEventChannelOp (Dev, EVTCHNOP_send, &Send);
>    ASSERT (ReturnCode == 0);
>  }
> +
> +UINT32
> +EFIAPI
> +XenBusEventChannelAllocate (
> +  IN  XENBUS_PROTOCOL *This,
> +  IN  domid_t         DomainId,
> +  OUT evtchn_port_t   *Port
> +  )
> +{
> +  XENBUS_PRIVATE_DATA *Private;
> +  evtchn_alloc_unbound_t Parameter;
> +  UINT32 ReturnCode;
> +
> +  Private = XENBUS_PRIVATE_DATA_FROM_THIS (This);
> +
> +  Parameter.dom = DOMID_SELF;
> +  Parameter.remote_dom = DomainId;
> +  ReturnCode = XenHypercallEventChannelOp (Private->Dev,
> +                                   EVTCHNOP_alloc_unbound,
> +                                   &Parameter);
> +  if (ReturnCode != 0) {
> +    DEBUG ((EFI_D_ERROR, "ERROR: alloc_unbound failed with rc=%d", ReturnCode));
> +    return ReturnCode;
> +  }
> +  *Port = Parameter.port;
> +  return ReturnCode;
> +}
> +
> +VOID
> +EFIAPI
> +XenBusEventChannelNotify (
> +  IN XENBUS_PROTOCOL *This,
> +  IN evtchn_port_t   Port
> +  )
> +{
> +  XENBUS_PRIVATE_DATA *Private;
> +
> +  Private = XENBUS_PRIVATE_DATA_FROM_THIS(This);
> +  XenEventChannelNotify (Private->Dev, Port);
> +}
> +
> +UINT32
> +EFIAPI
> +XenBusEventChannelClose (
> +  IN XENBUS_PROTOCOL *This,
> +  IN evtchn_port_t   Port
> +  )
> +{
> +  XENBUS_PRIVATE_DATA *Private;
> +  evtchn_close_t Close;
> +
> +  Private = XENBUS_PRIVATE_DATA_FROM_THIS (This);
> +  Close.port = Port;
> +  return XenHypercallEventChannelOp (Private->Dev, EVTCHNOP_close, &Close);
> +}
> diff --git a/OvmfPkg/XenBusDxe/EventChannel.h b/OvmfPkg/XenBusDxe/EventChannel.h
> index fb2845b..2cc8266 100644
> --- a/OvmfPkg/XenBusDxe/EventChannel.h
> +++ b/OvmfPkg/XenBusDxe/EventChannel.h
> @@ -47,4 +47,52 @@ XenEventChannelNotify (
>    IN evtchn_port_t Port
>    );
>  
> +/*
> + * XenBus protocol
> + */
> +
> +/**
> +  Allocate a port that can be bind from domain DomainId.
> +
> +  @param This       A pointer to the XENBUS_PROTOCOL.
> +  @param DomainId   The domain ID that can bind the newly allocated port.
> +  @param Port       A pointer to a evtchn_port_t that will contain the newly
> +                    allocated port.
> +
> +  @retval UINT32    The return value from the hypercall, 0 if success.
> +**/
> +UINT32
> +EFIAPI
> +XenBusEventChannelAllocate (
> +  IN  XENBUS_PROTOCOL *This,
> +  IN  domid_t         DomainId,
> +  OUT evtchn_port_t   *Port
> +  );
> +
> +/**
> +  Send an event to the remote end of the channel whose local endpoint is Port.
> +
> +  @param This       A pointer to the XENBUS_PROTOCOL.
> +  @param Port       Local port to the the event from.
> +**/
> +VOID
> +EFIAPI
> +XenBusEventChannelNotify (
> +  IN XENBUS_PROTOCOL *This,
> +  IN evtchn_port_t   Port
> +  );
> +
> +/**
> +  Close a local event channel Port.
> +
> +  @param This       A pointer to the XENBUS_PROTOCOL.
> +  @param Port       The event channel to close.
> +**/
> +UINT32
> +EFIAPI
> +XenBusEventChannelClose (
> +  IN XENBUS_PROTOCOL *This,
> +  IN evtchn_port_t   Port
> +  );
> +
>  #endif
> diff --git a/OvmfPkg/XenBusDxe/XenBus.c b/OvmfPkg/XenBusDxe/XenBus.c
> index 2e1f939..8c68809 100644
> --- a/OvmfPkg/XenBusDxe/XenBus.c
> +++ b/OvmfPkg/XenBusDxe/XenBus.c
> @@ -355,6 +355,9 @@ STATIC XENBUS_PRIVATE_DATA gXenBusPrivateData = {
>    .XenBusIo.SetState = XenBusSetState,
>    .XenBusIo.GrantAccess = XenBusGrantAccess,
>    .XenBusIo.GrantEndAccess = XenBusGrantEndAccess,
> +  .XenBusIo.EventChannelAllocate = XenBusEventChannelAllocate,
> +  .XenBusIo.EventChannelNotify = XenBusEventChannelNotify,
> +  .XenBusIo.EventChannelClose = XenBusEventChannelClose,
>    .XenBusIo.RegisterWatch = XenBusRegisterWatch,
>    .XenBusIo.RegisterWatchBackend = XenBusRegisterWatchBackend,
>    .XenBusIo.UnregisterWatch = XenBusUnregisterWatch,
> -- 
> Anthony PERARD
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

  parent reply	other threads:[~2014-09-12 13:58 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1409849473-9268-1-git-send-email-anthony.perard@citrix.com>
2014-09-04 16:50 ` [PATCH v2 01/18] OvmfPkg: Add public headers from Xen Project Anthony PERARD
2014-09-04 16:50 ` [PATCH v2 02/18] OvmfPkg: Add basic skeleton for the XenBus bus driver Anthony PERARD
2014-09-04 16:50 ` [PATCH v2 03/18] OvmfPkg/XenBusDxe: Add device state struct and create an ExitBoot services event Anthony PERARD
2014-09-04 16:50 ` [PATCH v2 04/18] OvmfPkg/XenBusDxe: Add support to make Xen Hypercalls Anthony PERARD
2014-09-04 16:51 ` [PATCH v2 05/18] OvmfPkg/XenBusDxe: Open PciIo protocol Anthony PERARD
2014-09-04 16:51 ` [PATCH v2 06/18] OvmfPkg: Introduce XenBus Protocol Anthony PERARD
2014-09-04 16:51 ` [PATCH v2 07/18] OvmfPkg/XenBusDxe: Add InterlockedCompareExchange16 Anthony PERARD
2014-09-04 16:51 ` [PATCH v2 08/18] OvmfPkg/XenBusDxe: Add Grant Table functions Anthony PERARD
2014-09-04 16:51 ` [PATCH v2 09/18] OvmfPkg/XenBusDxe: Add Event Channel Notify Anthony PERARD
2014-09-04 16:51 ` [PATCH v2 10/18] OvmfPkg/XenBusDxe: Add TestAndClearBit Anthony PERARD
2014-09-04 16:51 ` [PATCH v2 11/18] OvmfPkg/XenBusDxe: Add XenStore client implementation Anthony PERARD
2014-09-04 16:51 ` [PATCH v2 12/18] OvmfPkg/XenBusDxe: Add an helper AsciiStrDup Anthony PERARD
2014-09-04 16:51 ` [PATCH v2 13/18] OvmfPkg/XenBusDxe: Add XenStore function into the XenBus protocol Anthony PERARD
2014-09-04 16:51 ` [PATCH v2 14/18] OvmfPkg/XenBusDxe: Indroduce XenBus support itself Anthony PERARD
2014-09-04 16:51 ` [PATCH v2 15/18] OvmfPkg/XenBusDxe: Add Event Channel into XenBus protocol Anthony PERARD
2014-09-04 16:51 ` [PATCH v2 16/18] OvmfPkg/XenPvBlkDxe: Xen PV Block device, initial skeleton Anthony PERARD
2014-09-04 16:51 ` [PATCH v2 17/18] OvmfPkg/XenPvBlkDxe: Add BlockFront client Anthony PERARD
2014-09-04 16:51 ` [PATCH v2 18/18] OvmfPkg/XenPvBlkDxe: Add BlockIo Anthony PERARD
2014-09-04 18:01 ` [edk2] [PATCH v2 00/18] Introducing Xen PV block driver to OVMF Laszlo Ersek
     [not found] ` <5408A8E3.2020805@redhat.com>
2014-09-05 13:34   ` Anthony PERARD
     [not found]   ` <20140905133440.GB1654@perard.uk.xensource.com>
2014-09-05 19:30     ` Jordan Justen
2014-09-05 21:14     ` Laszlo Ersek
     [not found]     ` <CAFe8ug86UtwYQY-1P5wp6tQ_2Yi2fwgNU7+knHV0JH4SDz07jQ@mail.gmail.com>
2014-09-08 15:36       ` Anthony PERARD
     [not found] ` <1409849473-9268-2-git-send-email-anthony.perard@citrix.com>
2014-09-10 19:43   ` [PATCH v2 01/18] OvmfPkg: Add public headers from Xen Project Konrad Rzeszutek Wilk
     [not found] ` <1409849473-9268-3-git-send-email-anthony.perard@citrix.com>
2014-09-10 19:49   ` [PATCH v2 02/18] OvmfPkg: Add basic skeleton for the XenBus bus driver Konrad Rzeszutek Wilk
     [not found] ` <1409849473-9268-4-git-send-email-anthony.perard@citrix.com>
2014-09-10 19:58   ` [PATCH v2 03/18] OvmfPkg/XenBusDxe: Add device state struct and create an ExitBoot services event Konrad Rzeszutek Wilk
2014-09-18 10:33     ` Anthony PERARD
     [not found] ` <1409849473-9268-5-git-send-email-anthony.perard@citrix.com>
2014-09-10 20:01   ` [PATCH v2 04/18] OvmfPkg/XenBusDxe: Add support to make Xen Hypercalls Konrad Rzeszutek Wilk
     [not found] ` <1409849473-9268-6-git-send-email-anthony.perard@citrix.com>
2014-09-10 20:03   ` [PATCH v2 05/18] OvmfPkg/XenBusDxe: Open PciIo protocol Konrad Rzeszutek Wilk
     [not found] ` <1409849473-9268-7-git-send-email-anthony.perard@citrix.com>
2014-09-10 20:05   ` [PATCH v2 06/18] OvmfPkg: Introduce XenBus Protocol Konrad Rzeszutek Wilk
     [not found] ` <1409849473-9268-8-git-send-email-anthony.perard@citrix.com>
2014-09-10 20:09   ` [PATCH v2 07/18] OvmfPkg/XenBusDxe: Add InterlockedCompareExchange16 Konrad Rzeszutek Wilk
2014-09-18 10:55     ` Anthony PERARD
     [not found] ` <1409849473-9268-9-git-send-email-anthony.perard@citrix.com>
2014-09-10 20:12   ` [PATCH v2 08/18] OvmfPkg/XenBusDxe: Add Grant Table functions Konrad Rzeszutek Wilk
     [not found] ` <1409849473-9268-10-git-send-email-anthony.perard@citrix.com>
2014-09-10 20:15   ` [PATCH v2 09/18] OvmfPkg/XenBusDxe: Add Event Channel Notify Konrad Rzeszutek Wilk
2014-09-18 10:56     ` Anthony PERARD
     [not found] ` <1409849473-9268-11-git-send-email-anthony.perard@citrix.com>
2014-09-10 20:18   ` [PATCH v2 10/18] OvmfPkg/XenBusDxe: Add TestAndClearBit Konrad Rzeszutek Wilk
     [not found] ` <1409849473-9268-12-git-send-email-anthony.perard@citrix.com>
2014-09-10 20:48   ` [PATCH v2 11/18] OvmfPkg/XenBusDxe: Add XenStore client implementation Konrad Rzeszutek Wilk
2014-09-18 11:10     ` Anthony PERARD
     [not found] ` <1409849473-9268-13-git-send-email-anthony.perard@citrix.com>
2014-09-10 20:50   ` [PATCH v2 12/18] OvmfPkg/XenBusDxe: Add an helper AsciiStrDup Konrad Rzeszutek Wilk
     [not found] ` <1409849473-9268-14-git-send-email-anthony.perard@citrix.com>
2014-09-10 20:54   ` [PATCH v2 13/18] OvmfPkg/XenBusDxe: Add XenStore function into the XenBus protocol Konrad Rzeszutek Wilk
     [not found] ` <1409849473-9268-15-git-send-email-anthony.perard@citrix.com>
2014-09-11 17:10   ` [PATCH v2 14/18] OvmfPkg/XenBusDxe: Indroduce XenBus support itself Konrad Rzeszutek Wilk
2014-09-18 11:26     ` Anthony PERARD
     [not found] ` <1409849473-9268-16-git-send-email-anthony.perard@citrix.com>
2014-09-12 13:58   ` Konrad Rzeszutek Wilk [this message]
2014-09-18 11:28     ` [PATCH v2 15/18] OvmfPkg/XenBusDxe: Add Event Channel into XenBus protocol Anthony PERARD
     [not found] ` <1409849473-9268-17-git-send-email-anthony.perard@citrix.com>
2014-09-12 14:03   ` [PATCH v2 16/18] OvmfPkg/XenPvBlkDxe: Xen PV Block device, initial skeleton Konrad Rzeszutek Wilk
2014-09-18 11:31     ` Anthony PERARD
     [not found] ` <1409849473-9268-18-git-send-email-anthony.perard@citrix.com>
2014-09-12 14:47   ` [PATCH v2 17/18] OvmfPkg/XenPvBlkDxe: Add BlockFront client Konrad Rzeszutek Wilk
2014-09-18 11:53     ` Anthony PERARD
     [not found] ` <1409849473-9268-19-git-send-email-anthony.perard@citrix.com>
2014-09-12 14:57   ` [PATCH v2 18/18] OvmfPkg/XenPvBlkDxe: Add BlockIo Konrad Rzeszutek Wilk
2014-09-18 15:00     ` Anthony PERARD

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=20140912135853.GA14467@laptop.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=anthony.perard@citrix.com \
    --cc=edk2-devel@lists.sourceforge.net \
    --cc=xen-devel@lists.xen.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.